用于查找特定的记录,可以精确地查询,也可糊糊查询,功能相当于SQL语言的selcet
不过效率要低一些,所以建议直接用SQL语言,更加通用
function Lookup(const KeyFields: String; const KeyValues: Variant; const ResultFields: String): Variant; override;
其中KeyFields是字段名,KeyValues是字段值,可以是任意基本类型
ResultFields is a string containing a semicolon-delimited list of field names
它返回一个由ResultFields指定域的值的变量数组
如果你不想用SQL语言,也可以用locate这个更好用一些
function Locate(const KeyFields: String; const KeyFields: Variant; Options: TLocateOptions): Boolean
KeyFields和KeyFields和上面说明一样,
而Options是 TLocateOptions类型,是一个集合,
TLocateOption = (loCaseInsensitive, loPartialKey);
TLocateOptions = set of TLocateOption;
loCaseInsensitive 不分大小写.
loPartialKey 精确地匹配
for example, 'HAM' would match both 'HAMM' and 'HAMMER.'
它返回boolean,找到时,返回真,并把游标指向该记录。没有找到时,返回假