Ads

Ads

Translate

Wednesday, 20 March 2013

caranya mengabungkan isi dr chekbox ke dalam satu field

By Fajar  |  March 20, 2013 No comments


[ASK] agan2 & master2 semua, saya bikin form inputan seperti di gmbr, yg mau saya tanyakn gmna caranya mengabungkan isi dr chekbox ke dalam satu field.(delphi 7(zeos) & mysql)
syntax yg sdh ane biki kaya gini tp blom lengkap...
======================
with Dm.QInputPerijinan do
begin
Close;
SQL.Clear;
SQL.Text:='insert into tb_perijinan (id_perijinan,no_passport,tgl_permohonan,jenis_perijinan)'+
'values(:id,:pass,:tgl,:jenis)';
ParamByName('id').AsString:=Edit1.Text;
ParamByName('pass').AsString:=Edit2.Text;
ParamByName('tgl').AsString:=FormatDateTime('yyyy-MM-dd',DateTimePicker1.Date);
if RadioGroup1.ItemIndex=0 then
ParamByName('jenis').AsString:='Baru';
if RadioGroup1.ItemIndex=1 then
ParamByName('jenis').AsString:='Perpanjangan';
ExecSQL;
end;
================================
mohon bantuannya...
Buyut Joko Rivai
Penginputan Checkbox Tergantung tipe fieldnya. Yang pake tipe varchar(5), lalu pas inputnya pake: FieldByName('fotocopy').AsString := BoolToStr(CheckBox1.Checked, True);

Jangan lupa, RadioGroup.ItemIndex mempengaruhi grup checkbox di bawah. Bisa dikasih event, misalnya onclick pada RadioGroup:
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
GroupBox1.Enabled := RadioGroup1.ItemIndex = 0;
end;
Like  16 March at 14:13
Chipy PereSyza Pereira
bang Buyut Joko Rivai untuk filednya "syarat varchar(50)" bang. ane pengen chekbox1 & 2 bisa di inputkan jd satu di field syarat jd nanti hasilnya "fotocopy passport 1x, administrasiRp.5000"
Like  16 March at 14:22
Like  16 March at 14:42
Like  16 March at 15:32
ArRady Fuad Ar-Radhi
maksudnya gimana ini?
Like  16 March at 16:22
Chipy PereSyza Pereira
maksudnya ane pengen insert chkbox 1 dan 2 di jadikan satu di field syarat bang jadi nanti hasilnya kalo di tabel seperti ini
"Fotocopy Passport 1x, AdministrasiRp.5.000"
Like  16 March at 16:26
ArRady Fuad Ar-Radhi
itu kan tinggal di tambah aja :)
Like  16 March at 17:25
ArRady Fuad Ar-Radhi
x := '';
if a.checked then x := x + 'aaaaaa';
if b.checed then x := x + 'bbbbbbb';

fields[0].value := x;
Like  16 March at 17:26
Chipy PereSyza Pereira
ni bang sdh ane bikin kaya gini bang tp pas simpan muncul pesan Sql Error : column count dosen't match value count at row 1'
=============================
procedure TFrmPermohonanPerijinan.sBitBtn1Click(Sender: TObject);
var gabung, a, b : string;
begin
try Dm.koneksi.StartTransaction;
with Dm.QInputPerijinan do
begin
Close;
SQL.Clear;
SQL.Text:='insert into tb_perijinan (id_perijinan,no_passport,nama,tgl_permohonan,jenis_perijinan,syarat)'+
'values(:id,:pass,:nm,:tgl,:jenis:syrt)';
ParamByName('id').AsString:=Edit1.Text;
ParamByName('pass').AsString:=Edit2.Text;
ParamByName('nm').AsString:=Label4.Caption;
ParamByName('tgl').AsString:=FormatDateTime('yyyy-MM-dd',DateTimePicker1.Date);
if RadioGroup1.ItemIndex=0 then
ParamByName('jenis').AsString:='Baru';
if RadioGroup1.ItemIndex=1 then
ParamByName('jenis').AsString:='Perpanjangan';
if chk5.Checked=True then
a:='Fotocopy Passport 1x'
else a:='';
if chk6.Checked=True then
b:='Biaya Administrasi Rp.5.000' else b:='';
gabung:=a+b;
ParamByName('syrt').AsString:=gabung;
ExecSQL;
end;
Dm.koneksi.Commit;
Application.MessageBox('Permohonan anda berhasil disimpan','Informasi',MB_OK or MB_ICONINFORMATION);
Edit2.Clear;
RadioGroup1.ItemIndex:=-1;
edit2.SetFocus;
FrmPermohonanPerijinan.Close;
Exit;
except
Dm.koneksi.Rollback;
Application.MessageBox('Permohonan anda gagal disimpan','Perhatian',MB_OK or MB_ICONERROR);
Exit;
end;
============================
Like  16 March at 17:36
ArRady Fuad Ar-Radhi
column count dosen't match value count at row 1'
jika ga sama jumlah nya field sama value
Like  16 March at 17:38
ArRady Fuad Ar-Radhi
if RadioGroup1.ItemIndex=0 then
ParamByName('jenis').AsString:='Baru';
if RadioGroup1.ItemIndex=1 then
ParamByName('jenis').AsString:='Perpanjangan';

ini seharusnya ada else
Like  16 March at 17:39
Cahyo Sasongko
ijin menyimak..
Like  16 March at 17:41
ArRady Fuad Ar-Radhi
dibantu om :3
Like  16 March at 17:41
ArRady Fuad Ar-Radhi
ouhhhh bukan itu salahnya :o
tp ada koma (,) yang kurang :v
Like  16 March at 17:42
ArRady Fuad Ar-Radhi
'values(:id,:pass,:nm,:tgl,:jenis:syrt)';

ada yg kurang itu koma nya,,,
Like  16 March at 17:42
Cahyo Sasongko
itulah kelebihan programmer yg blom py istri...matanya pasti sangat awas...
Like  1  16 March at 17:44
ArRady Fuad Ar-Radhi
:v
wakakaka,,
didoain donk om biar punya -_-
Like  16 March at 17:45
Chipy PereSyza Pereira
hehe maaf bang ArRady Fuad Ar-Radhi dan bang Cahyo Sasongko kurang teliti, sdh bisa bang. tp pas nampilkan di dbgrid malah jd (MEMO)
Edited  Like  16 March at 17:47
ArRady Fuad Ar-Radhi
klo tipe MEMO memang seperti itu,, :)
harus diakali sedikit klo pake dbgrid standart
Like  16 March at 17:47
Chipy PereSyza Pereira
ane pake dbgrideh bang, cara ngakali di dbgrid gmna bang??
Like  16 March at 17:48
ArRady Fuad Ar-Radhi
klo dbrgideh ada di property nya,, draw memo,, ceklist aja
Like  16 March at 17:49
Chipy PereSyza Pereira
terima kasih bang (y) Buyut Joko Rivai, bang (y) ArRady Fuad Ar-Radhi, bang (y) Cahyo Sasongko sudah bisa. [SOLVED]

Author: Fajar

Hello, I am Author, decode to know more: In commodo magna nisl, ac porta turpis blandit quis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In commodo magna nisl, ac porta turpis blandit quis. Lorem ipsum dolor sit amet.

0 comments:

Best Post This Year

Install Fortesreport community Delphi 7 dan RX Berlin

Download  Pertama2 kita harus punya file installernya terlebih dahulu, download  https://github.com/fortesinformatica/fortesrepo...

Total Pageviews

© 2014 Fajar Priyadi. WP themonic converted by Bloggertheme9. Published By Gooyaabi Templates | Powered By Blogger
TOP