RAD Studio VCL Reference
TDataSet.Locate Method

Implements a virtual method for searching a dataset for a specified record and making it the active record.

function Locate(const KeyFields: string; const KeyValues: Variant; Options: TLocateOptions): Boolean; virtual;
virtual __fastcall Boolean Locate(const AnsiString KeyFields, const Variant KeyValues, TLocateOptions Options);

This function:  

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

Returns false, indicating that a matching record was not found and the active record was not changed. 

Descendant classes that are not unidirectional override this method so that it locates the record where the fields identified by the semicolon-separated list of fields in KeyFields have the values specified by the Variant or Variant array KeyValues. Options indicates whether the search is case insensitive and whether partial matches are supported. Locate returns true if a record is found that matches the specified criteria and that record is now active. 


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!