CreateDataSet (Delphi)
Contents
Description
The following code creates and activates a client dataset in the form's OnCreate event handler.
Code
procedure TForm1.FormCreate(Sender: TObject);
begin
with CDS2 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;
Uses
- Datasnap.DBClient.TCustomClientDataSet.CreateDataSet ( fr | de | ja )
- Data.DB.TDataSet.FieldDefs ( fr | de | ja )
- Data.DB.TFieldDefs.AddFieldDef ( fr | de | ja )
- Data.DB.TIndexDefs.AddIndexDef ( fr | de | ja )