Use the TDataSetProvider to transfer your Query data into the ClientDataSet. That component does everything for you.
Put the following components on your DataModule, and link them accordingly:
TZQuery <- TDataSetProvider <- TClientDataSet <- TDataSource
TDataSource.DataSet := TClientDataSet;
TCLientDataSet.ProviderName := TDataSetProvider;
TDataSetProvider.DataSet := TZQuery;
After that, just call the TClientDataSet.Open
method, and the data are transfered automaticaly into the TClientDataSet. With TClientDataSet.ApplyUpdates
, you can push back the data into your database.
I use that technic with firebird (TIBQuery).
Here are some information about ClientDataSets:
A ClientDataSet in Every Database Application
Delphi In Depth: ClientDataSet book
Building Applications With ClientDataSet and InterBase Express