Page 1 of 1

ClientDataSet records into SQLite table - HOW?

Posted: Fri 24 May 2019 09:20
by w.weiss
Hello!

I want to copy (insert) all the records from a TClientDataSet into a TUniTable (SQLite).
Data structure is the same of both sources.

Currently I am looping row by row, column by column and insert each value manually.
So is there a better (faster) way? I just need to transfer the data 1:1 into the target table (target table is empty).

Any ideas??

Re: ClientDataSet records into SQLite table - HOW?

Posted: Fri 24 May 2019 16:02
by MaximG
To solve your task, you can use the CRBatchMove class that comes with our components: https://www.devart.com/unidac/docs/deva ... chmove.htm
For example :

Code: Select all

uses CRBatchMove;
...
var
  crBatchMove: TCRBatchMove;
  CDS : TClientDataSet;
  UniQuery : TUniQuery;
begin
  ...
  crBatchMove := TCRBatchMove.Create(nil);
  try
    crBatchMove.Source := CDS;
    crBatchMove.Destination := UniQuery;
    crBatchMove.Execute;
  finally
    crBatchMove.Free;
  end;
end;