Accuracer: The First And Only Cross-Platform BDE Replacement
Client-Server Single-File Embedded Database with SQL for Delphi / C++Builder / Kylix


TDataSet.Fields
TDataSet
Top 

Lists all non-aggregate field components of the dataset.

property Fields: TFields;

Description
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 is able to 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;

Note:   
The preferred method for retrieving and assigning field values is to use persistent fields or the FieldByName method.

The next statements assigns a value from an edit box to a field:

CustTable.Edit;

CustTable.Fields.Fields[6].AsString := Edit1.Text;

CustTable.Post;

Note:   The AggFields property is a collection of all the dataset's aggregated fields. Thus, AggFields and Fields are mutually exclusive collections of the dataset's fields. These two properties contain all of the dataset's fields between them.


© AidAim Software Accuracer: Client-server Database Single-file Database Delphi Database Embedded Databas