Hi
Happy to see that there is a Delphi oriented DB list :
I meet some problem with TClientdataset and Calcfields.
My CDS contains 8 real fields and 4 calc fields all created with the field
editor in conception (i suppose it's not the best way to create fields but i
took the application like this).
When i do that all works fine :
----------------
if cdsCategories.Active then cdsCategories.Close;
cdsCategories.CreateDataSet;
----------------
but when my CDS has to be reopen another time (I voluntarily execute the
instructions 2 times) :
----------------
if cdsCategories.Active then cdsCategories.Close;
cdsCategories.CreateDataSet;
if cdsCategories.Active then cdsCategories.Close;
cdsCategories.CreateDataSet;
----------------
The second CreateDataset instruction raise an exception error (duplicate
field).
Can you tell me why ?
The only way i've found to avoid this exception is to do this :
----------------
if cdsCategories.Active then begin
cdsCategories.Close;
cdsCategories.FieldDefs.Update;;
while cdsCategories.FieldCount > 0 do begin
cdsCategories.Fields[cdsCategories.FieldCount-1].Free;
end;
end;
cdsCategories.CreateDataSet;
----------------
What is the best way to deal with that please ?
Cédric
_______________________________________________
Delphi-DB mailing list
[email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-db