Table1.IndexFieldNames:='NUM_1';
    Table1.First;
    Table1.SetKey;
    Table1.FieldByName('NUM_1').AsInteger:=StrToInt(ED_1.Text);
    Table1.FieldByName('NUM_2').AsInteger:=StrToInt(ED_2.Text);
    Table1.FieldByName('NUM_3').AsInteger:=StrToInt(ED_3.Text);
    Table1.FieldByName('NUM_4').AsInteger:=StrToInt(ED_4.Text);
    Table1.FieldByName('NUM_5').AsInteger:=StrToInt(ED_5.Text);
    Table1.FieldByName('NUM_6').AsInteger:=StrToInt(ED_6.Text);
    if Table1.GotoKey then
      begin
        DisInfo.Caption:='警告:库中已存在该记录!';
      end
    else
      begin
        DisInfo.Caption:='没有找到相同的记录!';
      end;
//这样写为什么总是报Tabel1: NO Index For fields 'Num_1' 的错误??  希望大哥大姐能给予解答```谢谢`

解决方案 »

  1.   

    楼主的问题,我不会。楼主,找相同记录还有别的方法啊。
    通过关键字的唯一性找资料,找到就说明有记录,找不到就说明没有。
    或者,把资料的键值写在 where 语句里面,找到就说明有记录,找不到就说明没有。
      

  2.   

    朋友们``真的很抱歉```
       本人刚用这个CSDN这个帐号`所以没有分``
      希望大家能够谅解``
      ````````````````````
      

  3.   

    用查询的方法:
    with query1 do
     begin
      close;
      sql.text:='select * from [table] where 关键字='+''''+要查找的关键字+'''';
      open;
     end;
    if query1.recCount>0 then showmessage('记录已存在');
    ....
      

  4.   

    楼上的兄弟,你的这句不安全噢,实践证明,某些情况下,这个会出现异常。if query1.recCount>0 then showmessage('记录已存在'); 最好是写成——if not query1.isEmpty then showmessage('记录已存在');