views:

517

answers:

3

What is the reason for getting an 'invalid parameter error' when calling the CreateDataSet method in a TClientDataSet component. What causes this error.

Kind Regards Riaan de Villiers

+1  A: 

Riaan,

are you using ftGuid fields? If so, you have to manually set the size of the field to 38.

regards, Lieven

Lieven
+1  A: 

Lieven is correct in noting that certain TFields have different needs, as far as their properties, before the ClientDataSet to which they are associated can be created (using CreateDataSet). But the TGuid field is not the only one.

If you are having trouble determining which of the fields are causing the problem, comment out all field types except one, TStringField for instance, and then try to create the ClientDataSet. If that first group causes no problems, move onto the next. It could be as simple as a BDC (binary coded decimal) field, or something more exotic.

Once you find a field type whose presence causes the error, use the help and make sure that you are including only properties meaningful for that field type.

Also, this could also be due to an invalid parameter in an TIndexDef. For example, TIndexDef instances do not support ixExpression indexes, even though the IndexDef collection editor permits you to set this option.

Good luck...

Cary Jensen
A: 

i was in same trouble, there was no apparent reason.. and then I discovered that by chance. Switch to text view and switch back to form view in form designer (alt+f10) Now try to do it again. It worked for me for several times. I think a bug causes that and with recreation of components it goes away..

AhmetC