Data.DB.TDataSet.Fields
Delphi
property Fields: TFields read FFields;
C++
__property TFields* Fields = {read=FFields};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | public | Data.DB.pas Data.DB.hpp |
Data.DB | TDataSet |
Description
Lists all non-aggregate field components of the dataset.
Use Fields to access field components. If fields are generated dynamically at runtime, the order of field components in Fields corresponds directly to the order of columns in the table or tables underlying a dataset. If a dataset uses persistent fields, then the order of field components corresponds to the ordering of fields specified in the Fields editor at design time.
When ObjectView is true, the fields are stored hierarchically, meaning any child fields of an object field are referenced by the object field and don't appear sequentially after the object field in the TFields Fields array. When ObjectView is false, the fields are stored sequentially, or flattened out, meaning any child fields of an object field are stored sequentially in the TFields Fields array.
Accessing fields with the Fields property is useful for applications that:
Iterate over some or all fields in a dataset.
Work with underlying tables whose internal data structure is unknown at runtime.
If an application knows the data types of individual fields, then it can read or write individual field values through the Fields property. For example, the following statement assigns a field value to the Text property of an edit box:
Edit1.Text := CustTable.Fields.Fields[6].AsString;
Edit1->Text = CustTable->Fields->Fields[0]->AsString;
Note: The preferred method for retrieving and assigning field values is to use persistent fields or the FieldByName method.
Note: The AggFields property is a collection of all the dataset's aggregated fields. AggFields and Fields are mutually exclusive collections of the dataset's fields. These two properties contain all of the dataset's fields between them.