FireDAC.Comp.DataSet.TFDDataSet.Data

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Data: IFDDataSetReference read GetData write SetData;

C++

__property _di_IFDDataSetReference Data = {read=GetData, write=SetData};

Properties

Type Visibility Source Unit Parent
property public
FireDAC.Comp.DataSet.pas
FireDAC.Comp.DataSet.hpp
FireDAC.Comp.DataSet TFDDataSet

Description

Represents the data of the dataset, allowing to fully copy data from one dataset into another.

The Data property represents the dataset's internal in-memory data storage. Using this property, an application can copy the current structure and data of one FireDAC dataset to another FireDAC dataset. 

The property value is a reference to the IFDDataSet interface. It is reference-counted and the application does not need to explicitly free it. If the application keeps the interface reference using a variable or a field, then the reference must be released before the dataset is closed. 

The dataset must be inactive to set this property value, otherwise an exception is raised. After its setting, the Self dataset:

  • Has a structure of an original dataset, excluding Indexes, IndexDefs, Filter, and so on.
  • Has a copy of an original dataset data, including all row versions and states (inserted, deleted, updated, unchanged).
  • Has CachedUpdates equal to True, if an original dataset has unapplied changes.
  • Is open.

Example

FDQuery1.SQL.Text := 'select * from orders; select * from customers';

FDQuery1.Open;
FDQuery1.FetchAll;
// assign orders records to FDMemTable1
FDMemTable1.Data := FDQuery1.Data;

FDQuery1.NextRecordSet;
FDQuery1.FetchAll;
// assign customers records to FDMemTable2
FDMemTable2.Data := FDQuery1.Data;

See Also