Make copy of DataSet

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Pavel95
Posts: 3
Joined: Mon 06 Jun 2022 11:23

Make copy of DataSet

Post by Pavel95 » Mon 06 Jun 2022 11:37

Hello,
I am converting our old code with ado components to a new one using TUni..

I am having a problem with code like this:

AdoQuery.open();
AdoQuery.first();
AdoDataSet.Recordset := AdoQuery.Recordset;
AdoQuery.close();

It supossed to make a copy of AdoQuery data. Can i do something like that with TUniQuery?
I know that TUniQuery neither TDataSet have not RecordSet. But is there an elegant way to make a copy of data to another TDataSet or TUniQuery from TUniQuery?

pavelpd
Devart Team
Posts: 109
Joined: Thu 06 Jan 2022 14:16

Re: Make copy of DataSet

Post by pavelpd » Fri 24 Jun 2022 17:00

Hi Pavel,
Thanks for contacting us!

To copy data you can use the TCRBatchMove component that comes with our components.
More information you can find using the provided link:
https://www.devart.com/unidac/docs/deva ... chmove.htm

An example of using TCRBatchMove to copy data from TUniQuery to TVirtualTable:

Code: Select all

uses
  ... , CRBatchMove;
 
  ...
var
  CRBatchMove: TCRBatchMove;
  UniQuery: TUniQuery;
  VirtualTable: TVirtualTable;
  ...
begin
  ...
  CRBatchMove := TCRBatchMove.Create(nil);
  try
    CRBatchMove.Source := UniQuery;
    CRBatchMove.Destination := VirtualTable;
    CRBatchMove.Execute;
  finally
    CRBatchMove.Free;
  end;
  ...
end;

Post Reply