Jump to content
Sign in to follow this  
Himie

Using ClientDataSets

Recommended Posts

Hi Folks

I have been using Delphi for quite some time but have just started trying to use ClientDataSets to utilize their nested data.  I have been attempting for some days now to make these work according to the books and articles I have downloaded but it will just not work.  Your suggestions are most sought.

I put a ClientDataSet (called cdsJournal) on my DataModule, a DataSource (called dsJournal) and a DataSetProvider (called dspJournal).  I endeavor to link them putting in the DataSet in the dspJournal as cdsJournal, the DataSet of the DataSource as cdsJournal, and the Filename of the cdsJournal set to D:\Mens Shed Accounting\Journal\2020-21_07_January.  It has an error for the ClientDataSet with 'no ProviderName'.  If I put this in (which is dspJournal) I get an error 'No circular references allowed' (obviously the cdsJournal referencing the dspJournal and the dspJournal referencing the cdsJournal).  If I remove the DataSet reference (cdsJournal) from the dspJournal I get the error 'No DataSet'.  Accoriding to the books it should work even without a DataSetProvider but other books say that a ClientDataSet does not have this built in.  I just don't know where to go.  I have the book Delphi in Depth: ClientDataSets by Cary Jensen and a number of other books which I have tried to follow meticulasly but to no avail.

Thank you in advance.  I am using Community Edition of Delphi 10.4.

Ross

Share this post


Link to post

As long as you are working with CDS, that load their data from a file, there is no need for an provider. Just use master/detail as usual.

 

You can try this example to see how a provider comes into play along with a nested dataset:

Put a TQuery on a form and connect it to some database. Drop a TDataset and wire it to the Query.

Put another Query on the form and connect the mater property to the dataset.

Put a provider an the form and coinnect it to the first query.

Put a clientdataset on the form and connect it to the provider. Now you can retrieve the fields and have the second query as a nested dataset.

Share this post


Link to post

Have a look here:

 

This is a talk from Cary Jensen about nested ClientDataSets - the same author you have that excellent book from.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×