locate主要用于查找数据,但是它的查找速度没有finding和going定位快。下面我举一个例子。
procedure TForm1.LocateBtnClick(Sender: TObject);
begin
Start;
if ClientDataSet1.Locate('Field1,Field2..',VarArrayOf['value1,value2..'], []) then
begin
Done;
StatusBar1.Panels[3].Text :=
'Match located at record ' +
IntToStr(ClientDataSet1.RecNo);
end
else
begin
Done;
StatusBar1.Panels[3].Text := 'No match located';
end;
end;
函数原型为clientdataset 1.locate(const KeyFields: String; const KeyValues: Variant;Options: TLocateOptions): Boolean;
参数 :KeyFields 是查询的字段名;
KeyValues 是查询的条件值;
Options 是查询标准 ,分为
[ loCaseInsensitive] 不分大小写
[ loPartialKey] 部分字符
[ ] 一模一样
参数 :KeyFields 是查询的字段名;
KeyValues 是查询的条件值;
Options 是查询标准 ,分为
[ loCaseInsensitive] 不分大小写
[ loPartialKey] 部分字符
[ ] 一模一样
本文介绍Delphi中ClientDataSet1.Locate函数的用法,包括如何通过指定字段和值来查找匹配记录,并提供了完整的代码示例。
clientdataset的locate函数&spm=1001.2101.3001.5002&articleId=42102989&d=1&t=3&u=accbf25215e845cea8c2ef42600faef3)

被折叠的 条评论
为什么被折叠?



