In my application I have the following code in a
TClientDataSet.OnBeforeOpen() handler:

      with TIntegerField.Create(cdsJob) do
      begin
         FieldName := 'release_ref';
         FieldKind := fkData;
         Dataset   := cdsJob;
         Name      := Dataset.name + FieldName;
         cdsJob.fielddefs.add(Name,ftInteger,0,false);
         cdsJob_copy.fielddefs.add(Name,ftInteger,0,false);
      end;

I'm creating the TField, and also updating the FieldDefs collection,
however, calling the CreateDataSet() returns with "cdsJob: Field
'release_ref' not found.".

The above code is called within a conditional block that checks for a
database that includes it, the TClientDataSet has persistent fields already
setup in it, as does the TQuery its based on.  Do I need to add a
TField/FieldDef's reference to the underlying TQuery as well as the
TClientDataSet?

Hmm, I just changed the code so that it added the TField/FieldDef's to both
the query and the client data set but no joy :(  (and yes - the field DOES
exist in the database).

Mark




---------------------------------------------------------------------------
  New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to