Source := ExtractFilePath(Application.ExeName) + 'date\kgl.mdb';
ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' +Source + ';Mode=Read;Persist Security Info=False;JetOLEDB:DatabasePassword=11111;
adoconnection1.Open;我用odbc连接时用where语句可以,但是用上面那个连接的时候就不可以,请各位大侠指教

解决方案 »

  1.   

    你的连接字符串有些问题,正确的应该是
    ADOConnection1.ConnectionString := Provider=Microsoft.Jet.OLEDB.4.0;Password=test;Data Source=' +Source +';Persist Security Info=True';
    ADOConnection1.Connected := True;
    OLEDB 驱动程序对各参数出现的位置敏感,具体原因不详。
      

  2.   

    不是呀,上段字符串可以运行就是在执行where语句的时候不能运行,说是form错误
      

  3.   

    不是呀,上段字符串可以运行就是在执行where语句的时候不能运行,说是form错误------------------------------------------------------------------------------
    把你的SQL语句复制下来我看看
      

  4.   

    procedure TForm3.RadioButton2Click(Sender: TObject);//打开r1
    var
      huan: han;
      str: string;
    begin
        groupbox4.Enabled:=false;
        groupopen('t');
        huan:=han.Create;
        str:='select * from fisrt order by id asc';
        cxdbbuttonedit1.DataBinding.DataField:='';
        huan.open(adoquery1,str);
        adoquery1.First;
        combobox1.Clear;
        while not adoquery1.Eof do
        begin
          combobox1.Items.Add(adoquery1.FieldByName('km').AsString);
          adoquery1.Next;
        end;
        str:='select * from second order by id asc';
        huan.open(adoquery1,str);
        huan.Free;
    end;
      

  5.   

    procedure TForm3.RadioButton1Click(Sender: TObject);
    var
      huan: han;
      str: string;
    begin
        groupbox4.Enabled:=false;
        groupopen('t');
        combobox1.Clear;
        huan:=han.Create;
        str:='select * from fisrt order by id asc';
        cxdbbuttonedit1.DataBinding.DataField:='';
        huan.open(adoquery1,str);
        huan.Free;
    end;这个是可以运行的,上面那个是不是可以运行的
      

  6.   

    就是没有找到了first了,也就是没有找到数据库了
    ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' +Source + ';Mode=Read;Persist Security Info=False;JetOLEDB:DatabasePassword=11111;
    写错了!!!!!!!!