当前位置:编程学习 > C#/ASP.NET >>

ADO 连接sql2005的时候出的错误。

 da.Fill(ds,Common.Class1.tabale_users);用户代码未处理 System.Data.SqlClient.SqlException
  Message="在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)"
  Source=".Net SqlClient Data Provider"
  ErrorCode=-2146232060
  Class=20
  LineNumber=0
  Number=2
  Server=""
  State=0
  StackTrace:
       在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       在 System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
       在 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
       在 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
       在 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()
       在 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       在 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       在 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
       在 DataAccess.Class1.getUsers() 位置 D:\WEB\DataAccess\DataAccess\Class1.cs:行号 18
       在 _Default.Page_Load(Object sender, EventArgs e) 位置 d:\WEB\WebSite6\Default.aspx.cs:行号 18
       在 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
       在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
       在 System.Web.UI.Control.OnLoad(EventArgs e)
       在 System.Web.UI.Control.LoadRecursive()
       在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: 
--------------------编程问答-------------------- 检查连接字符串。你可以先用vs测试下连接。 --------------------编程问答-------------------- http://www.cnblogs.com/JoshuaDreaming/archive/2011/03/09/1977818.html --------------------编程问答-------------------- 链接字符串是不是有问题,如果没有的话就是SQL中设置有问题!楼主最好把链接字符串贴出来,或在vs工具中测试一下链接,提示链接成功了,复制一下连接字符串就ok了
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,