-1

need a lot of help. got alot of problem here like dbgrid didnt update after i inserted a data. how many ado query i need ? using param or not is the better where > can anyone give me some example...

if (edit1.text='')  or (combobox1.text='') or (combobox2.text='') or(combobox3.text='') or(combobox4.text='')
then
  ShowMessage(' DATA BELUM LENGKAP' )
ELSE
  button2.enabled :=false;
datamodule1.adotable1.Open;
with datamodule1.ADOTable1 do
begin

      append;
      FieldByName('No_medrec').AsString := concat(Edit2.Text,'-',edit3.text);
      FieldByName('nama').AsString := edit1.Text;
      FieldByName('lama').AsString := combobox1.text;
      FieldByName('status').AsString :=combobox3.text;
      FieldByName('keterangan').AsString :=combobox2.text;
     FieldByName('tanggal_berobat').AsString :='';
     FieldByName('poli').AsString :=combobox4.text;
      Post;
         Showmessage('Data berhasil disimpan');
end;

i use adoquery1 for datasource1 that connect to dbgrid...and use adotable for inserting data....

LHristov
  • 1,103
  • 7
  • 16

1 Answers1

1

If your dbgrid is connected to adoquery1 but your inserting data via adotable1, you won't see the changes until you call adoquery1.Refresh. But you don't need to use adotable1 to do the inserts - you could do them by doing the insert into adoquery1, assuming adoquery1 and adotable1 use the same Sql.

MartynA
  • 30,454
  • 4
  • 32
  • 73