var
  Form1: TForm1;
  var con:string;implementation{$R *.dfm}procedure TForm1.FormActivate(Sender: TObject);begin
con:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=caiwu;Data Source=YJW '  ;
ADOConnection1.ConnectionString:=con;
     ADOConnection1.Connected :=true;
    adoquery1.Connection:= ADOConnection1;end;procedure TForm1.Button1Click(Sender: TObject);
begin
   if   RadioButton1.Checked=true  then
  begin
    adoquery1.SQL.Clear;
          adoquery1.SQL.Add('SELECT * FROM RenYuanBiao WHERE UserName='+''''+Edit1.Text+'''');
          adoquery1.open;
     end;
     if   RadioButton2.Checked=true  then
    begin
    adoquery1.SQL.Clear;
          adoquery1.SQL.Add('SELECT * FROM RenYuanBiao WHERE name='+''''+Edit1.Text+'''');
          adoquery1.open;
     end;
end;end.查询没反应!
并且要求要输入password

解决方案 »

  1.   

    你的Adoconnection1连接串没设置密码,自然要求输入password.设置 ADOConnection1.LoginPrompt:=false;
    con串要改下,把密码加上。
      

  2.   

       con:='Provider=SQLOLEDB.1;Password=123;Persist Security Info=True;User ID=sa;Initial Catalog=caiwu;Data Source=127.0.0.1';
    加了密码还是要你输入密码!
      输入后查询还是没反应!
      

  3.   

    你的查询是弹出出错提示还是这么回事,是不是少了Adoquery1.active:=true;
      

  4.   

    你试下这样行不行?
     if   RadioButton1.Checked=true  then 
      begin 
       with adoquery1 do
        close;
        filter:='usernaem= '''+eidt1.text+'''';
        filtered:=true;
        open;
        end;
      end;
        
      
      

  5.   

              adoquery1.SQL.close;
              adoquery1.SQL.Clear; 
              adoquery1.SQL.Add('SELECT * FROM RenYuanBiao WHERE name='+''''+Edit1.Text+''''); 
              adoquery1.open;