〔帮助文件摘抄之一〕建立空的ClientDataSet记录集

                            The following code creates and activates a client dataset in the form's OnCreate event handler:

procedure TForm1.FormCreate(Sender: TObject);

begin
  with ClientDataSet1 do
  begin
    with FieldDefs.AddFieldDef do 
    begin
      DataType := ftInteger;
      Name := 'Field1';
    end;
    with FieldDefs.AddFieldDef do
    begin
      DataType := ftString;
      Size := 10;
      Name := 'Field2';
    end;
    with IndexDefs.AddIndexDef do
    begin
      Fields := 'Field1';
      Name := 'IntIndex';

    end;
    CreateDataSet;
  end;
end;
                                

查看回复