简体   繁体   中英

Invalid parameter error with TClientdataset

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

When you have an ftString datatype field and the size of that is zero or not provided, then it also may cause this kind of error. I have tried creating the fieldefs for the dataset and haven't specified the size for the string field. I ended up with the same error.

Riaan,

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

regards, Lieven

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...

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..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM