What I'm trying to achieve to to insert/copy records from a tClientDataSet to a database table(Database is Sybase ASA).
I also have a form with a cxgrid on it which I can see the records from the cds, so I know there are records in it.
At the click of a button I do the following:
with dmData.cds do
begin
Close;
Open;
First;
while not (EOF) do
begin
dmData.qry1.Open;
dmData.qry1.Insert;
dmData.qry1.FieldByName('field1').AsString := dmData.cds.FieldByName('field1').AsString;
dmData.qry1.FieldByName('field2').AsString := dmData.cds.FieldByName('field2').AsString;
dmData.qry1.FieldByName('field3').AsString := dmData.cds.FieldByName('field3').AsString;
dmData.qry1.Post;
Next;
end;
end;
I don't get any errors after this is done but when looking in the database table there are no records inserted.
I don't know what I'm doing wrong, any help would be much appreciated.