function connect(ip:string):boolean;
begin
  dataconfigU.ADOCon:=TADOConnection.Create(nil);
  dataconfigU.ADOCon.LoginPrompt:=false;
  dataconfigU.ADOCon.KeepConnection:=true;
  ADOCon.ConnectionString:='Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=college;Datasource="'+ip+'" ';
  ADOCon.Open;
end;
各位高手帮看看。。帮改改一直卡在这

解决方案 »

  1.   

    if 信任连接 then
        Connstr := Format('Provider=SQLOLEDB.1;Password=;Persist Security Info=True;User ID=;Initial Catalog=%s;Data Source=%s;Integrated Security=SSPI',[FDBName,FServerName])
      else
        Connstr := Format('Provider=SQLOLEDB.1;Password=%s;Persist Security Info=True;User ID=%s;Initial Catalog=%s;Data Source=%s',[FPassword,FUserName,FDBName,FServerName]);
      

  2.   

    http://www.connectionstrings.com/sql-server
      

  3.   

     try
        with Conn do
          begin
            ConnectionString :=
              'Password='+UPassword
              +';Persist Security Info=false;User ID='
              + Username+';Initial Catalog='
              + databasename
              +';Data Source='+servername;
            LoginPrompt :=false;
           end;
           Conn.Connected :=true;
       except
        on E:Exception  do
          begin
            MessageBox(handle,Pchar('数据库连接出错'+#13+'原始提示:'+E.Message),'错误', MB_OK + MB_ICONERROR);
            application.Terminate;
          end;
      end;
      

  4.   


    function connect(ip:string):boolean; 
    begin 
      dataconfigU.ADOCon:=TADOConnection.Create(nil); 
      dataconfigU.ADOCon.LoginPrompt:=false; 
      dataconfigU.ADOCon.KeepConnection:=true; 
      ADOCon.ConnectionString:='Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=college;Datasource="'+ip+'" '; 
      try
        ADOCon.Open; 
      except
        raise;     // 把异常抛出来看下,   如果是混合认证, 你这段代码应该是可以的.
      end;
    end; 
      

  5.   

    function connect(ip:string):boolean; 
    begin 
      dataconfigU.ADOCon:=TADOConnection.Create(nil); 
      dataconfigU.ADOCon.LoginPrompt:=false; 
      dataconfigU.ADOCon.KeepConnection:=true; 
      ADOCon.ConnectionString:='Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=college;Datasource="'+ip+'" '
      ADOCon.Open; 
    end; 符号错了??