Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Missing data provider or datapacket

Status
Not open for further replies.

ionutdinulescu

Programmer
Jun 11, 2002
59
GB
I have a TClientDataset that takes the records from a .cds file. When I open the clientdataset, whenever there are no records in the file, the above error occurs.

What is the solution to this (stupid) situation ?
 
Do you have a TDataSetProvider component so that the TClientDataSet component can actually get some data?

You should also have a TSQLDataSet component and a TSQLConnection component (and probably a TDataSource component but this depends on what you are doing).

Andrew
 
heh...this is a real chicken and the egg problem. Your CDS needs the *.cds file in order to get its field definitions etc, but what do you do if you have no data?

if you know what the fields etc are that you will be using, you can simple create the field-defs dynamically and then do a cds.CreateDataSet; once the user has added any data etc and the CDS is closed, it will automatically save to the file you specified in cds.Filename.

Other than that, you could try creating a 'blank' *.cds file by creating the field-defs then doing:

cds.CreateDataSet;
cds.Open;
cds.ChangeLog := False;

Add a record, delete it and then:

cds.ApplyUpdates;
cds.Close;

This will create the *.cds file with a memory of the 'test' record you entered, but you will never be able to recover the 'test' record using cds.UndoLastChange.

This ends up giving you a 'basically' blank *.cds file :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top