我初学DELPHI 输入用户名之后点回车.出现以下错误.该如何处理
project jsl.exe raised exception class EOleException with message '连接字符串属性无效 '
Process stopped .Use Step or Run to continue

解决方案 »

  1.   

    查看adotable或adoconnection的connectionstring属性设置是否正确。
      

  2.   

    是和数据库连接相关的,是ole的异常。看看你的调用是不是数据库连接的open跳出的异常
      

  3.   

    是的。在q.open 处出错。如何处理?
    procedure TfrmLogin.btnOKClick(Sender: TObject);
    var q:TadoQuery;
    begin
      userid:=txtUserId.Text;
      q:=TadoQuery.Create(nil);
      q.Connection:=data.Connection;
      q.SQL.Text:='SELECT * FROM Users WHERE UserID='+quotedstr(userid);
      q.Prepared;
      q.Open;
      if(q.Bof=true)and(q.Eof=true) then
      begin
        messagedlg('没有此用户名,请与管理员联系!',mtinformation,[mbOK],0);
        q.Close;
        q.Free;
        logCount:=logCount+1;
        txtUserID.SetFocus
      end
      else
      begin
        Password:=q.fieldbyname('Password').AsString;
        if Password<>'' then Password:=UncrypStr(Password,pKey);
        if txtPassword.Text=Password then
        begin
          username:=q.fieldbyname('Name').AsString;
          Manage:=q.FieldByName('Manage').AsBoolean;
          q.Close;
          q.Free;
          LogOk:=true;
          close
        end
        else
        begin
           messagedlg('密码错误,请重新输入!',mtinformation,[mbOK],0);
           logCount:=logCount+1;
           q.Close;
           q.Free;
           txtPassword.SetFocus
        end;
      end;
     if logCount=3 then
      begin
        LogOk:=false;
        close
      end;
    end;
      

  4.   

    把你的ConnectionString贴出来看看
      

  5.   

    你的ConnectionString有问题
    或者是 你的adoquery没有连接到adoconnection上
      

  6.   

    adoquery Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=gs;Data Source=.;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=BPGL;Use Encryption for Data=False;Tag with column collation when possible=False