ADOQuery.Clone,How to realize

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
cxg417
Posts: 41
Joined: Thu 26 Mar 2009 08:07

ADOQuery.Clone,How to realize

Post by cxg417 » Mon 30 Mar 2009 11:50

My English is very poor!
ADOQuery.Clone,How to realize
________
Alaska Dispensary
Last edited by cxg417 on Tue 15 Feb 2011 14:55, edited 1 time in total.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 01 Apr 2009 07:56

You can use the TVirtualTable component. Copy data from TUniQuery to TVirtualTable using the TCRBatchMove component. Or save data to a file using the TUniQuery.SaveToXML method, and then load it to TVirtualTable using its LoadFromFile method.

cxg417
Posts: 41
Joined: Thu 26 Mar 2009 08:07

Post by cxg417 » Fri 03 Apr 2009 09:00

The loadfromxml method is so slowly! and,crbatchmove have not 'bmCopy'
________
Universal Health Warehouse
Last edited by cxg417 on Thu 10 Mar 2011 10:56, edited 1 time in total.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 06 Apr 2009 08:23

The default Mode of CRBatchMove - bmAppend - adds all data from one dataset to another. What should the bmCopy you are talking about do?

Pavel95
Posts: 3
Joined: Mon 06 Jun 2022 11:23

Re: ADOQuery.Clone,How to realize

Post by Pavel95 » Mon 06 Jun 2022 12:37

I have similiar porblem, and tried your suggestion with TCRBatchMove. :

CRBatchMove1.Mode := bmAppend;
CRBatchMove1.Source := UniQuery1;
CRBatchMove1.Destination := VirtualDataSet1;
CRBatchMove1.Execute;

But i get Error like this on Execute:
The OnGetRecordCount event handler is not specified'.

When i implement just empty event OnGetRecordCount on VirtualDataSet1, i get no errors, but nothing happens - none data were copied.

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

Re: ADOQuery.Clone,How to realize

Post by pavelpd » Fri 01 Jul 2022 12:31

Hi Pavel,
Thanks for your request.

TVitrualDataSet component is not designed to copy data. It doesn’t store data in memory.
Its task is to interact with data through event handlers.
It can be used to represent of arbitrary data (arrays, lists etc.) in tabular form.
You can find a more detailed description of the TVitrualDataSet component in our online documentation:
https://docs.devart.com/virtualdac/deva ... ataset.htm


To copy data, use the TVirtualTable component instead of the TVitrualDataSet component.
The TVirtualTable component represents an in-memory data storage that does not have linked data files.
TVirtualTable allows to load data from a XML file, or from an existing dataset, and then process the data in the usual way, as in any TDataSet descendant.
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