var
s:string;
opt:TLocateOptions;
begin
with table1 do
begin
opt:=[loPartialKey];
locate('Name',edit1.Text,opt);
s:=table1.FieldValues['PerNum'];
end;
end;
编译的时候没有错误,不过s的值一直为空,不知道是怎麽回事?赐教!
s:string;
opt:TLocateOptions;
begin
with table1 do
begin
opt:=[loPartialKey];
locate('Name',edit1.Text,opt);
s:=table1.FieldValues['PerNum'];
end;
end;
编译的时候没有错误,不过s的值一直为空,不知道是怎麽回事?赐教!
lacate('name',trim(edit1.text),[]);
如果还有错误就是你表的链接有问题;了;
s: String;
opt: TLocateOptions;
Begin
With ADOquery1 Do
Begin
opt := [loPartialKey];
locate('mingcheng', Edit1.Text, opt);
s := ADOQuery1.FieldValues['Mingcheng'];
Label1.Caption := s;
End;
End;
我试过 没有问题的呀就算是没有匹配的数据 也会显示第一条数据的 楼主再看看吧
s:string;
opt:TLocateOptions;
begin
with table1 do
begin
opt:=[loPartialKey];
if locate('Name',edit1.Text,[]) then//!!!!!
s:=table1.FieldValues['PerNum']//少用这种方式,用Table1.FieldByName(l..
else
ShowMessage('定位不成功');
end;
end;