1
I have to record several records at once in the database, I’m using it in the form below, however I think giving applyupdate to each interaction is not the right way. There is another way?
procedure TFrm.Button1Click(Sender: TObject);
Var
i: Integer;
begin
(ds.DataSet as TClientdataset).Open;
For i := 1 to 10 do
begin
(ds.DataSet as TClientdataset).Insert;
ds.DataSet.FieldByName('med1').AsInteger:= 1;
ds.DataSet.FieldByName('med2').AsInteger:= 1;
ds.DataSet.FieldByName('med3').AsInteger:= 2;
ds.DataSet.FieldByName('med4').AsDateTime:= Now;
ds.DataSet.FieldByName('med5').AsFloat:= 1;
ds.DataSet.FieldByName('med6').AsDateTime:= Now;
(ds.DataSet as TClientdataset).Post;
(ds.DataSet as TClientdataset).ApplyUpdates(0);
end;
end;