TurboDB VCL Component Library


TTdbTable        See also

Previous  Top  Next

Searches for a record containing specified field values.

Delphi syntax:

function FindKey(const KeyValues: array of const): Boolean;

C++ syntax:

bool __fastcall FindKey(const System::TVarRec* KeyValues, const int KeyValues_Size);


Call FindKey to search for a specific record in a dataset. KeyValues contains a comma-delimited array of field values, called a key. Each value in the key can be a literal, a variable, a null, or nil. If the number of values passed in KeyValues is less than the number of columns in the index used for the search, the missing values are assumed to be null.

The key must always be an index, which can be specified in the IndexName property. If IndexName is empty, FindKey uses the table's primary index.

If the search is successful, FindKey positions the cursor on the matching record and returns True. Otherwise the cursor is not moved, and FindKey returns False.