Jasa pembuatan Aplikasi dan website

header ads

SIMPAN MENGGUNAKAN ADOQUERY

KOMPONEN:
1.form17
2.ADOConnection1
3.ADOQuery1
4.DataSource1

procedure TForm17.btnSimpanClick(Sender: TObject);
begin
if(edit1.Text = '') or (edit2.Text = '') or (memo1.Text = '')or (edit3.Text='')or(edit4.Text='')  then
    MessageDlg('Kode, Nama,alamat,Telepon dan email harus diisi.', mtwarning, [mbok], 0)
    else
begin
//menyimpan  ke tabel barang
 DataModule16.ADOQuery1.SQL.Clear;
 DataModule16.ADOQuery1.SQL.Add('insert into tblpbf(kode, nama, alamat, telepon, email)');
 DataModule16.ADOQuery1.SQL.Add('values("'+Edit1.Text+'","'+Edit2.Text+'","'+memo1.Text+'","'+Edit3.Text+'","'+Edit4.Text+'")');
 DataModule16.ADOQuery1.ExecSQL;

 //refresh data dengan adoquery1
 DataModule16.ADOQuery1.SQL.Clear;
 DataModule16.ADOQuery1.SQL.Add('select* from tblpbf');
 DataModule16.ADOQuery1.Open;
end;
Edit1.Text:='';
Edit2.Text:='';
memo1.Text:='';
Edit3.Text:='';
Edit4.Text:='';
//combobox1.Text:='';
end;

Post a Comment

0 Comments