var
s:string;
opt:TLocateOptions;
begin
with table1 do
begin
opt:=[loPartialKey];
locate('Name',edit1.Text,opt);
s:=table1.FieldValues['PerNum'];
end;
end;
编译的时候没有错误,不过s的值一直为空,不知道是怎麽回事?赐教!
...全文
393打赏收藏
看看下面的编码有什莫错误吗?
var s:string; opt:TLocateOptions; begin with table1 do begin opt:=[loPartialKey]; locate('Name',edit1.Text,opt); s:=table1.FieldValues['PerNum']; end; end; 编译的时候没有错误,不过s的值一直为空,不知道是怎麽回事?赐教!
var
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;
Var
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;
我试过 没有问题的呀就算是没有匹配的数据 也会显示第一条数据的 楼主再看看吧