From RAD Studio API Documentation
Jump to: navigation, search


property FieldValues[const FieldName: string]: Variant read GetFieldValue write SetFieldValue; default;


__property System::Variant FieldValues[const System::UnicodeString FieldName] = {read=GetFieldValue, write=SetFieldValue/*, default*/};


Type Visibility Source Unit Parent
property public
Data.DB TDataSet


Provides access to the values for all fields in the active record for the dataset.

Use FieldValues to read and write values for fields in a dataset. FieldName is the name of a field to read from or write to.

FieldName can represent simple field names, qualified field names for subfields of an object field, or aggregated fields such as can be found in the AggFields property. Because of this flexibility, it is often preferable to use the FieldValues property (or the FieldByName method) rather than the Fields, FieldList, or AggFields properties, all of which present a more limited selection of the dataset's fields.

FieldValues accepts and returns a Variant, so it can handle and convert fields of any type. Because FieldValues is the default property for TDataSet, you can omit the property name when referencing this property. For example, the following statements are semantically identical and write the value from an edit box into an integer field:

Customers.FieldValues['CustNo'] := Edit1.Text;
Customers['CustNo'] := Edit1.Text;

Customers->FieldValues["CustNo"] = Edit1->Text;

Note: Because FieldValues always uses Variants, it may be a somewhat slower method of accessing data, than using a field's native format (for example, using a field's AsXXX property), especially in applications that process large amounts of data.

See Also

Code Examples