定位
多字段
ADOTable1.Locate('id;age',VarArrayOf(['108',21]),[loPartialKey]);
单字段
ADOTable1.Locate('id','108',[loPartialKey]);
Lookup与定位类似
单字段
var v:Variant;
begin
//根据ID,返回姓名
v:=ADOTable1.Lookup('id','108','age');
if VarType(v) <> varNull then
begin
ShowMessage(IntToStr(v));
end;
end;
多字段
var v:Variant;
begin
//根据ID,姓名,搜索,返回姓名,年龄
v:=ADOTable1.Lookup('id;age',VarArrayOf(['108',21]),'name;age');
if VarType(v) <> varNull then
begin
ShowMessage(v[0]+inttostr(v[1]));
end;
end;
循环
with ADOTable1 do
begin
DisableControls;
First;
while not eof do
begin
ShowMessage(Fields[1].Value);
Next;
end;
EnableControls;
end;