AnyDAC
ContentsIndexHome
PreviousUpNext
TADDataSet.Data Property

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

Group
Links

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

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

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

  • has a structure of an original dataset, excluding Indexes, IndexDefs, Filter, etc;
  • has a copy of an original dataset data, including all row versions and states (inserted, deleted, updated, unchanged);
  • has CachedUpdates = True, if an original dataset has unapplied changed;
  • is open.
property Data: IADDataSetReference;
ADQuery1.SQL.Text := 'select * from orders; select * from customers';

ADQuery1.Open;
ADQuery1.FetchAll;
// assign orders records to ADMemTable1
ADMemTable1.Data := ADQuery1.Data;

ADQuery1.NextRecordSet;
ADQuery1.FetchAll;
// assign customers records to ADMemTable2
ADMemTable2.Data := ADQuery1.Data;
What do you think about this topic? Send feedback!