Copying TADOQuery query results into a TClientDataSet - RAD 2007, C++ Builder personality


2007-11-27 12:12:43 AM
cppbuilder50
I have a TADOQuery whose query results I was trying to get into a
TClientDataSet.
I know I can iterate through and Insert() / Post() into the client
dataset, but I was trying to use the TClientDataSet::Data property.
I've tried making a TDataSetProvider, whose DataSet is the TADOQuery
involved, then assigning the TDataSetProvider::Data to the
TClientDataSet::Data property, but that doesn't appear to work.
That is, the TClientDataSet doesn't appear to have data in this after
assigning it (First() sets EOF). I can do a
TDataSetProvider::DataSet->First(), and see I have data before the
assignment, but the assignment itself doesn't appear to do anything.
I've tried making an intermediate TClientDataSet, and using
SetProvider() to point to the TDataSetProvider involved, and assigning
from TClientDataSet::Data to TClientDataSet::Data (again, after
verifying the source has data), but again, no luck.
What am I doing wrong?
Thanks,
PaulR