Delphi的帮助是这样写的:
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;
Description
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.
总之,举例来说就是这样的:
Table1.Locate('查找的内容', 查找的字段, [])
最后中括号可以不填写内容,也可以填写如下内容
loCaseInsensitive:大小写不敏感
loPartialKey :可以是查找内容的一部分