本人想在combobox的下拉框中选取一个item作为query组件的查询条件,程序如下:query1.sql.add('select * from customer');
query1.sql.add('where custno=combobox1.text');在编译时无法通过,先是显示text为invalid field,修改后来又显示capability not supported.
新手上路,请大家不吝赐教

解决方案 »

  1.   

    query1.sql.add('select * from customer');
    //如果custno数值型字段
    query1.sql.add('where custno='+combobox1.text);
    //如果是字符型
    query1.sql.add('where custno='''+combobox1.text+'''');
      

  2.   

    string str_test
    str_test:='select * from customer where custno='+combobox1.text
    query1.sql.add(str_test)
      

  3.   

    var
      SqlStr : string;
    begin
      sqlstr := format('select * from where custno ="%s"',[combobox1.text]);
      query1.close;
      query1.sql.clear;
      query1.sql.add(SqlStr);
      ..............
    end;