System.Data.SqlClient.SqlException: 在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: SQL 网络接口, error: 25 - 连接字符串无效) 在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) 在 System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) 在 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) 在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) 在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) 在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) 在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) 在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) 在 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) 在 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) 在 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) 在 System.Data.SqlClient.SqlConnection.Open() 在 _Default.Button1_Click(Object sender, EventArgs e)怎么解决啊?急用.多谢

解决方案 »

  1.   

    首先确认sa与网络访问都打开。然后确认sql2000是否打了补丁?没有打补丁的话在xp sp2系统下只能本机访问。安装sql sp3。
      

  2.   

    有几个 asp 的站在上面呢,没问题,做了个.net 的,不知道为什么连不上数据库.
      高手给看一下,多谢.了
      

  3.   

    你在IIS配置里面配置一下asp.net吧,估计是这个的错误,编译错误中显示的是连接Sql Server 2005
      

  4.   

    是啊 我用的是sql 2000 ,怎么配置,指点一下,谢了.
      

  5.   

    在Visual S 2005中打开服务器资源管理器,里面有肯定有两个连接。
    删了那个和SQL2005连接的。
      

  6.   

    在本地测试 没问题,放到服务器上,就有问题.
     
     在服务器 上建了个 aa.udl 测试连接,服务器地址只能 用 . 才能连接上,虽然能用了,为什么呀?用 ip + 端口就 连接不上
      

  7.   

    以前也碰到过,SQL server2000一定要打SP3以上的补丁,还有在安装VS.NET 2005时,不要安装SQL
    Serve 2005 Express