Delphi通过查找字符定位TADOQuery数据的位置

     通过TADOQuery的方法Locate,输入字符,查找到定位到对应的数据位置,优点快速定位,缺点是只匹配查找到的和第一个位置,无法连续定位下一个!

//定位
qrymembertype.Locate('Cname', Cname, [loCaseInsensitive]);

'Cname'列名
Cname 所匹配的值
loCaseInsensitive, loPartialKey] 不区分大小写,部分匹配
[loCaseInsensitive] 不区分大小写
[loPartialKey] 部分匹配
[] 完全相同

同进匹配多个属性:
if edtsearch.Text <> '' then
  begin
    if not qry1.Locate('Cid', edtsearch.Text, [loPartialKey]) then
    begin
      if not qry1.Locate('cname', edtsearch.Text, [loPartialKey]) then
      begin
        qry1.Locate('cago', edtsearch.Text, [loPartialKey]);
      end;
    end;
  end;

原文地址:https://www.cnblogs.com/jijm123/p/10546509.html