RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TDataSet.Lookup Method

Implements a virtual method to retrieve field values from a record that matches specified search values.

Pascal
function Lookup(const KeyFields: string; const KeyValues: Variant; const ResultFields: string): Variant; virtual;
C++
virtual __fastcall Variant Lookup(const AnsiString KeyFields, const Variant KeyValues, const AnsiString ResultFields);

This function: 

Checks whether the dataset is unidirectional, and if so, raises an EDatabaseError exception. 

Returns a Variant with the value false, indicating that a matching record was not found. 

Descendant classes that are not unidirectional override this method so that it locates the record where the fields identified by the comma-delimited string KeyFields have the values specified by the Variant or Variant array KeyValues. In classes that implement Lookup, it returns a Variant or Variant array that contains the value or values of the fields specified by the comma-delimited string ResultFields on the specified record. 

 

Locate 

Using Indexes to Search for Records 

Using Locate 

Using Lookup

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!