Invalid parameter error with TClientdataset
Asked Answered
C

4

6

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

Chukar answered 1/2, 2009 at 19:44 Comment(0)
I
9

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.

Inoperative answered 16/11, 2011 at 7:8 Comment(1)
+1 I was fighting this problem and this is what I found out. I was passing 0 thinking it would be automatic - got my hopes up though.Iceboat
O
4

Riaan,

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

regards, Lieven

Outdate answered 1/2, 2009 at 19:54 Comment(0)
S
3

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

Selfdevotion answered 10/7, 2009 at 22:49 Comment(0)
G
1

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

Gaylord answered 13/11, 2009 at 0:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.