请大家来帮帮忙;小弟被这个搞晕了。
在combobox中,我是通过self.ADOTable1.GetFieldNames(ComBoBox1.Items);调用表中的字段名,是成功的。
但是接下来我想引用我从下拉框选中的字段名来查询时,引用不了。引用语句是:
select * from 商品清单 where combobox1.ItemIndex='''+edit1.Text+'''
请问要怎么改?
感激不尽啊!!

解决方案 »

  1.   

    select * from 商品清单 where combobox1.ItemIndex='''+edit1.Text+'''
    这个不是数据库中的字段名啊
    select * from 商品清单 where '''+combobox1.ItemIndex+'''='''+edit1.Text+''' 
      

  2.   

    sql.add('select * from 商品清单 where '''+combobox1.ItemIndex+'''='''+edit1.Text+'''')
      

  3.   

    'select * from 商品清单 where '+inttostr(combobox1.ItemIndex)+'='''+edit1.Text+''''