Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Query on TClientDataSet (CDS file) in Delphi XE?

I converted a 2.8 MB XML file into a ClientDataSet in Delphi XE. The XML file changes quite frequently and I am basically building a new CDS file programmatically every time the XML changes. It's not only the content the changes, but also the actual structure.

The question is: Is it possible to use simple SQL on ClientDataSet1 to create a second ClientDataSet with a result table in memory? If the answer is yes, what are the basic mechanics? Currently I am only using TClientDataSet and TDataSource to make the database available to data-aware components.

like image 874
Delphinarium Avatar asked Apr 07 '12 06:04

Delphinarium


1 Answers

No, you can't run a SQL sentence over a TClientDataSet when is used as a memory dataset, because doesn't have associated a SQL provider. You best option is use the filtering capabilities included in the TClientDataSet. For that you can use Ranges or Filters and then clone the result in a secondary TClientDataSet. for more details about filtering try this article Filtering ClientDataSets

like image 66
RRUZ Avatar answered Sep 18 '22 22:09

RRUZ