我用的table和database这两个组件链接的数据库,数据库用的是accesss,看看这个查找的
procedure TForm1.BitBtn4Click(Sender: TObject);
var
  a:boolean;
  b,c:string;
begin  b:=combobox1.Items.Text;
  c:=edit1.Text;
  a:=table1.locate(b,c,[]);
  if a then
    showmessage('find!')
  else
    showmessage('sorry');
end;
编译能通过,只是在combobox1中选择了一个字段类型后,在edit1中输入要查找的关键字就会出现错误对话框,写的是:
project project1.exe raised exception class edatabaseerror with message'table1:filed'
id
name
sex
mobliephone
familyphone
qq
msn
address
workaddress'not found'.process stopped.use step or run to continue.
请问高手们,怎么解决?辛苦你们一下了,先谢谢你们了

解决方案 »

  1.   

    从出错信息来看,是table1的那些字段没找到。
    还有,我从你的代码里根本就看不出对数据库的操作,连关联都没有。
      

  2.   

    b:=combobox1.Items.Text;
    你的combobox1里面存的必须是已经有的字段,不能随便填的
      

  3.   

    combobox1中我填了id,name,sex,mobliephone,familyphone,qq,msn,address,workaddress这些可选项了啊,比如说我选择了id(按id查找),再在edit中输入一个id号码,点击BitBtn4后就出现那样的错误对话框。
    再辛苦你们一下
    给俺详细解释清楚可以么?
      

  4.   

    b := combobox1.Items[ItemIndex];
      

  5.   

    加个query1.sql的属性是 select * from 你那个表
        combobox1.items.add('query1.filedbyname[i].asstring');
    大概就是这样了,就是把表的字段名加给combobox1的下拉列表中去