RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TADODataSet.MasterFields Property

Specifies field or fields on which a Master-Detail link is based.

Pascal
property MasterFields: WideString;
C++
__property BSTR MasterFields;

Use MasterFields after setting the MasterSource or DataSource property to specify the names of one or more fields in another, master, dataset that are used to establish a Master-Detail relationship between this dataset and the master dataset. The master dataset is specified by assigning its data source to the MasterSource or DataSource property. 

MasterFields is a string containing one or more field names in the master dataset. When the datasets are related based on two fields, separate field names with semicolons:

ADOTable2.MasterSource := DataSource1;
ADOTable2.MasterFields := 'CustID;SaleDate'

 

ADOTable2->MasterSource = DataSource1;
ADOTable2->MasterFields = "CustID;SaleDate"

Each time the current record in the master dataset changes, the new values in those fields are used to select corresponding records in this table for display.

Note: At design time, use the Field Link designer to establish the master-detail relationship between two tables.
 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!