Yet More CDS questions (CreateDataSet)

I'm trying to setup a script that will clear a TClientDataSet, add fields, then create the dataset.

Using Seattle.

Prepare:
  atScripter1.DefineClassByRTTI(TDataSet,'',[mvpublic,mvpublished],true) ;
  atScripter1.DefineClassByRTTI(TCustomClientDataSet,'',[mvpublic,mvpublished],true);
  atScripter1.AddComponent(cds2);

(note that I've tried with defining just TDataset, just TCustomClientDataSet, and both. No difference in behaviour)


btn1Click:
  atScripter1.SourceCode.Text:=ScrMemo1.Lines.Text;
  atScripter1.ExecuteSubroutine('PrepCDS',[cds2]);


Script:
 procedure PrepCDS(CDS:TDataset);
  begin
   with CDS.FieldDefs do
    begin
      Clear;
      Add('ID',ftInteger, 0, True);
      Add('FirstName',ftString, 20,false);
      Add('LastName',ftString, 25,false);
      Add('DOB',ftDate,0,false);
      Add('Active',ftBoolean,0,false);
    end;
    CDS.CreateDataSet;
  end;

I always get: "Unknown member identifier: 'CreateDataSet'."
(same for CDS.IndexDefs.Clear - also generates "Unknown member..." error).

I would have expected CreateDataSet to automatically be registered from DefineClassByRTTI calls.

Am I missing something blindingly obvious?

Thanks.

EdB




 



It was the "Blindingly Obvious".

Change
procedure PrepCDS(CDS:TDataset);
to
procedure PrepCDS(CDS:TClientDataset);

and suddenly CreateDataSet works.

<sigh>

EdB