views:

519

answers:

2

Hi

I use nested database stuctures with TClientDataSets. I'm new to programming so my lingo is ten-to-one wrong.

My problem is as follows: I defined my database stucture and all the fields of the nested stuctures and then I called the CreatDataSet method of the master clientDataSet and it worked. I then wanted to add another data field to the master ClientDataSet. I then called the ClearData method of the Master ClientDataSet and then tried to create the new stucture by calling CreateDataSet again. It is here where I encounter my problem. I get the 'Invalid field type error' and I don't really know or understand what what the problem is.

So how do I create an exsta field after I called the createdata set method, then called the cleardata method, then added a field and then calling the createdataset method again without getting the 'invalid field type error?

Does anybody have any information about this problem. I use Delphi 2007

Kind Rgards

Riaan de Villiers

+1  A: 

It is a Delphi bug.

Call YourDataset.FieldDefs.Clear before calling CreateDataSet and it should work.

For more infomation please look at this QC Report:

http://qc.codegear.com/wc/qcmain.aspx?d=38984

EDIT:

After reading your problem more carefully, the problem might be something else, but please try the FieldDefs.Clear and let me know the results.

Fabio Gomes
I though of FieldDefs too. Normally StoreDefs (for standard TClientDatasets) is set to True.
Fabricio Araujo
A: 

It has been a long time since you asked this question, but I believe the problem has specifically to do with the nested dataset fields. I've seen this error before, and I believe that it has to do with the order in which the particular fields are created. If I remember correctly, if you try to create the master dataset before the nested dataset fields are defined or created, you get this invalid field type error.

Begin by removing your nested dataset fields from the equation and see if you still get the problem. If not, then add them back. Try creating the master dataset and its nested datasets in different orders.

I know this is late, but I hope it helps.

Cary Jensen