Skip to main content

TdxCustomMemData.AddFieldsFromDataSet(TDataSet,TComponent) Method

Automatically re-creates missing fields based on field information retrieved from a specified dataset.

Declaration

procedure AddFieldsFromDataSet(ADataSet: TDataSet; AOwner: TComponent = nil);

Parameters

Name Type
ADataSet TDataSet
AOwner TComponent

Remarks

Call this method to retrieve field information (existing fields or their definitions) from the dataset specified by the ADataSet parameter and create corresponding fields within a TDataSet descendant passed as the AOwner parameter. If nil is passed as AOwner, fields are created within the current ExpressMemData component.

This method first checks whether a field type is supported by the ExpressMemData component and then creates only fields that are missing (based on field names in ADataSet and AOwner). All the main data type-specific property values are also copied from the source dataset fields.

The CreateFieldsFromDataSet method calls the AddFieldsFromDataSet method internally to create necessary fields.

Note

If ADataSet contains a field with the name associated with the ‘RecId’ field (see RecIdField), this field will not be created in AOwner. To overcome this, change the default name of the field via the RecIdField.FieldName property before the AddFieldsFromDataSet or CreateFieldsFromDataSet method is called.

See Also