FireDAC.Comp.Client.TFDTable.CreateDataSet

From RAD Studio API Documentation
Jump to: navigation, search

[–] Properties
Type:
procedure
function
Visibility: public
Source:
FireDAC.Comp.Client.pas
FireDAC.Comp.Client.hpp
Unit: FireDAC.Comp.Client
Parent: TFDTable

Delphi

procedure CreateDataSet; override;

C++

virtual void __fastcall CreateDataSet();

Description

Creates new empty internal data storage for a dataset.

FireDAC.Comp.Client.TFDTable.CreateDataSet inherits from FireDAC.Comp.DataSet.TFDDataSet.CreateDataSet. All content below this line refers to FireDAC.Comp.DataSet.TFDDataSet.CreateDataSet.

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;

See Also