CreateDataSet (C++)
Contents
Description
The following code creates and activates a client dataset in the form's OnCreate event handler.
Code
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
TFieldDefs *pDefs = CDS2->FieldDefs;
TFieldDef *pDef = pDefs->AddFieldDef();
pDef->DataType = ftInteger;
pDef->Name = "Field1";
pDef = pDefs->AddFieldDef();
pDef->DataType = ftString;
pDef->Size = 10;
pDef->Name = "Field2";
TIndexDef *pIDef = CDS2->IndexDefs->AddIndexDef();
pIDef->Fields = "Field1";
pIDef->Name = "IntIndex";
CDS2->CreateDataSet();
}
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 )