Delphi Database, Delphi Components from ComponentAce
Products Download Order Contact us
TDataSet.FieldValues
TDataSet
Top 


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

property FieldValues[const FieldName: string]: Variant; default;

Description
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.

FieldValues reads from and writes to fields whether FieldName represents simple field names, qualified field names for subfields of an object field, or aggregated fields such as can be found in the AggFields property. Due to 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;

The next statement reads a string value from a field into an edit box:

Edit1.Text := Customers['Company'];

Note:
   As FieldValues always uses Variants, it may be a somewhat slower method of accessing data, than using a field's native format (i.e., using a field's AsXXX property), especially in applications processing large amounts of data.
        © 2003 - 2024 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Dec 22, 2024