我做的主要--明细数据库应用程序,一个主表,另一个细表
我刚开始用FindKey来查询,
代码如下:
with table1 do
begin
label1.Caption:='';
indexfieldnames:='CustNo';
if findkey([Edit1.Text]) then
label1.Caption:='ok'
else
label1.Caption:='failed';
end;
后来用GotoKey来查询,发觉不行,只能默认查询第一条的数据,为什么呢?是TTable什么属性影响呢?
with table2 do
begin
Label1.Caption:='';
IndexFieldnames:='CustNo';
setkey;
FieldByName('CustNo').AsString:=Edit1.Text;
if GotoKey then
Label1.Caption:='查找成功'
else
Label1.Caption:='查找失败';
end;