begin
 adoquery1.Close;//1
 adoquery1.SQL.Clear;
 adoquery1.sql.add('select * from try where num1='+combobox1.Text);
 adoquery1.active:=true ;
end;

解决方案 »

  1.   

    num:=strToInt(combobox1.Text)
     adoquery1.Close;//1
     adoquery1.SQL.Clear;
     adoquery1.sql.add('select * from try where convert(int,num)'+num);
     adoquery1.active:=true ;
      

  2.   

    应该是procedure TForm1.ComboBox1Click(Sender: TObject);
    var
    num:integer;
    begin
     num:=strToInt(combobox1.Text)
     adoquery1.Close;//1
     adoquery1.SQL.Clear;
     adoquery1.sql.add('select * from try where num1=' +num);
     adoquery1.active:=true ;
    end;
      

  3.   

    动态参数:
    adoquery1.close;
    adoquery1.sql.clear;
    adoquery1.sql.add('select * from try where num1=:num');
    adoquery1.parameters.parambyname('nub').asstring:=combobox1.text;
    adoquery1.open
      

  4.   

    应该是procedure TForm1.ComboBox1Click(Sender: TObject);
    var
    num:integer;
    begin
     num:=strToInt(combobox1.Text)
     adoquery1.Close;//1
     adoquery1.SQL.Clear;
     adoquery1.sql.add('select * from try where num1='''+num+'''');
     adoquery1.active:=true ;
    end;
      

  5.   

    procedure TForm1.ComboBox1Click(Sender: TObject);
    var
    num:integer;
    begin
     num:=strToInt(combobox1.Text)//这个地方是不是少了一个分号???????
     adoquery1.Close;//1
     adoquery1.SQL.Clear;
     adoquery1.sql.add('select * from try where num1=num');//这个地方num不能这样使用,.应该如下或者使用动态参数!
     adoquery1.sql.add('select * from try where num1='''+num+'''');
     adoquery1.active:=true ;
    end;
    你们都有没有研究过delphi的错误提示阿!语法错误!哦呀!这样的问题,真可悲阿!还有这么多的人没有找出来!