FireDAC.Comp.DataSet.TFDDataSet.CreateDataSet
Delphi
procedure CreateDataSet; virtual;
C++
virtual void __fastcall CreateDataSet();
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | FireDAC.Comp.DataSet.pas FireDAC.Comp.DataSet.hpp |
FireDAC.Comp.DataSet | TFDDataSet |
Description
Creates new empty internal data storage for a dataset.
Use CreateDataSet at run time to create an empty internal data storage for a dataset and activate the dataset.
After the call, the application can populate the dataset with data and optionally save data to the external file. Optionally, the dataset can be created setting Active to True.
If the FieldDefs property contains items, then these values are used to create field definitions. Otherwise, the Fields property is used. One or both of these properties must contain values in order to create a dataset. If neither property is set, CreateDataSet raises an exception.
Note that this method is applicable only for TFDCustomMemTable.
Example
with FDMemTable1 do begin
FieldDefs.Add('ID', ftAutoInc);
FieldDefs.Add('Code', ftString, 10);
FieldDefs.Add('Name', ftString, 50);
CreateDataSet;
// here dataset is active, has 3 fields and is empty
end;