日期:2014-05-19  浏览次数:20440 次

System.Data.SqlClient.SqlException: 在建立与服务器的连接时出错。
winxp+sqlserver2000,sqlserver2000和程序是在两台机器上;在网上搜的东西也没有解决问题;
请教:


System.Data.SqlClient.SqlException:   在建立与服务器的连接时出错。在连接到   SQL   Server   2005   时,在默认的设置下   SQL   Server   不允许进行远程连接可能会导致此失败。   (provider:   命名管道提供程序,   error:   40   -   无法打开到   SQL   Server   的连接)   在   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()

------解决方案--------------------

sql server 2005要允许远程连接,
http://support.microsoft.com/?kbid=914277&SD=tech
------解决方案--------------------
确保你的sql 开了1433
确保用户名密码正确
------解决方案--------------------
1.telnet 服务器 1433
2.在客户端的链接配置中增加服务器的Ip或名称
3.用Odbc试试

------解决方案--------------------
运行isqlw看能不能连上.
------解决方案--------------------
用这种形式试试
server=ip;user id=sa;data source=dbname
------解决方案--------------------
服务器配置问题
------解决方案--------------------
防火墙的问题 可能
------解决方