Sign in Join
FPDoc Onlineexperiment

TDataSet.Lookup function

Member of TDataSetpublicIn unit DB

Search for a record and return matching values.

Declaration

pascal
function Lookup(const KeyFields: string; const KeyValues: Variant; 
 const ResultFields: string): Variant; virtual

Arguments

KeyFields

Semicolon-separated list of fieldnames to locate record.

KeyValues

Values for keyfields to locate record with.

ResultFields

Semicolon-separated list of fieldnames whose values must be returned.

Function result

Value(s) of ResultFields.

Description

Lookup always returns Null in TDataset. Descendents of TDataset can override this method to call Locate to locate the record with fields KeyFields matching KeyValues and then to return the values of the fields in ResultFields. If ResultFields contains more than one fieldname (separated by semicolons), then the function returns an array. If there is only 1 fieldname, the value is returned directly.

Errors

If the dataset is unidirectional, then a EDatabaseError exception will be raised.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.