TurboDB VCL Component Library

TTdbDataSet.Lookup

TTdbDataSet

Previous  Top  Next

Retrieves field values from a record that matches specified search values.

Delphi syntax:

function Lookup(const KeyFields: String; const KeyValues: Variant; const ResultFields: String): Variant;

C++ syntax:

virtual Variant __fastcall Lookup(const AnsiString KeyFields, const Variant &KeyValues, const AnsiString ResultFields);

Description

Call Lookup to retrieve values for specified fields from a record that matches search criteria. KeyFields is a string containing a semicolon-delimited list of field names on which to search.

KeyValues is a variant array containing the values to match in the key fields. To specify multiple search values, pass KeyValues as a variant array as an argument, or construct a variant array on the fly using the VarArrayOf routine.

ResultFields is a string containing a semicolon-delimited list of field names whose values should be returned from the matching record.

Lookup returns a variant array containing the values from the fields specified in ResultFields. If the specified record could not be found, the variant is Null. If ResultFields contains only one item, the result value is simple (non-array) variant.