问题描述
无法打开登录所请求的数据库"NovelWeb"。登录失败。用户'PC-20150207FICVAdministrator'登录失败。说明:执行当前Web请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。异常详细信息:System.Data.SqlClient.SqlException:无法打开登录所请求的数据库"NovelWeb"。登录失败。用户'PC-20150207FICVAdministrator'登录失败。源错误:行38:{行39:con=newSqlConnection(connstring);行40:con.Open();行41:}行42:///<summary>源文件:d:biyeshejiNovelWebApp_CodeDALSqlHelper.cs行:40堆栈跟踪:[SqlException(0x80131904):无法打开登录所请求的数据库"NovelWeb"。登录失败。用户'PC-20150207FICVAdministrator'登录失败。]System.Data.SqlClient.SqlInternalConnection.OnError(SqlExceptionexception,BooleanbreakConnection,Action`1wrapCloseInAction)+92System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjectstateObj,BooleancallerHasConnectionLock,BooleanasyncClose)+285System.Data.SqlClient.TdsParser.TryRun(RunBehaviorrunBehavior,SqlCommandcmdHandler,SqlDataReaderdataStream,BulkCopySimpleResultSetbulkCopyHandler,TdsParserStateObjectstateObj,Boolean&dataReady)+3731System.Data.SqlClient.TdsParser.Run(RunBehaviorrunBehavior,SqlCommandcmdHandler,SqlDataReaderdataStream,BulkCopySimpleResultSetbulkCopyHandler,TdsParserStateObjectstateObj)+69System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(BooleanenlistOK)+30System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfoserverInfo,StringnewPassword,SecureStringnewSecurePassword,BooleanignoreSniOpenTimeout,TimeoutTimertimeout,BooleanwithFailover)+347System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfoserverInfo,StringnewPassword,SecureStringnewSecurePassword,BooleanredirectedUserInstance,SqlConnectionStringconnectionOptions,SqlCredentialcredential,TimeoutTimertimeout)+818System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimertimeout,SqlConnectionStringconnectionOptions,SqlCredentialcredential,StringnewPassword,SecureStringnewSecurePassword,BooleanredirectedUserInstance)+320System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentityidentity,SqlConnectionStringconnectionOptions,SqlCredentialcredential,ObjectproviderInfo,StringnewPassword,SecureStringnewSecurePassword,BooleanredirectedUserInstance,SqlConnectionStringuserConnectionOptions,SessionDatareconnectSessionData,DbConnectionPoolpool,StringaccessToken)+591System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptionsoptions,DbConnectionPoolKeypoolKey,ObjectpoolGroupProviderInfo,DbConnectionPoolpool,DbConnectionowningConnection,DbConnectionOptionsuserOptions)+304System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPoolpool,DbConnectionowningObject,DbConnectionOptionsoptions,DbConnectionPoolKeypoolKey,DbConnectionOptionsuserOptions)+38System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionowningObject,DbConnectionOptionsuserOptions,DbConnectionInternaloldConnection)+681System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionowningObject,DbConnectionOptionsuserOptions,DbConnectionInternaloldConnection)+89System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnectionowningObject,UInt32waitForMultipleObjectsTimeout,BooleanallowCreate,BooleanonlyOneCheckConnection,DbConnectionOptionsuserOptions,DbConnectionInternal&connection)+426System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnectionowningObject,TaskCompletionSource`1retry,DbConnectionOptionsuserOptions,DbConnectionInternal&connection)+78System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnectionowningConnection,TaskCompletionSource`1retry,DbConnectionOptionsuserOptions,DbConnectionInternaloldConnection,DbConnectionInternal&connection)+191System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnectionouterConnection,DbConnectionFactoryconnectionFactory,TaskCompletionSource`1retry,DbConnectionOptionsuserOptions)+154System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnectionouterConnection,DbConnectionFactoryconnectionFactory,TaskCompletionSource`1retry,DbConnectionOptionsuserOptions)+21System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1retry)+90System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1retry)+166System.Data.SqlClient.SqlConnection.Open()+96SqlHelper.OpenDataBase()ind:biyeshejiNovelWebApp_CodeDALSqlHelper.cs:40SqlHelper.GetDataReader(StringSqlstr)ind:biyeshejiNovelWebApp_CodeDALSqlHelper.cs:84daohang.showdaohang()ind:biyeshejiNovelWebdaohang.ascx.cs:22daohang.Page_Load(Objectsender,EventArgse)ind:biyeshejiNovelWebdaohang.ascx.cs:17System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Objectsender,EventArgse)+51System.Web.UI.Control.OnLoad(EventArgse)+95System.Web.UI.Control.LoadRecursive()+59System.Web.UI.Control.LoadRecursive()+131System.Web.UI.Control.LoadRecursive()+131System.Web.UI.Control.LoadRecursive()+131System.Web.UI.Page.ProcessRequestMain(BooleanincludeStagesBeforeAsyncPoint,BooleanincludeStagesAfterAsyncPoint)+2952
解决方案
解决方案二:
先用mssql客户端连接看能否能查询这些。
解决方案三:
好像看不到了
解决方案四:
连接字符串贴出来呢,当然先确认你的帐号密码能登录
解决方案五:
检查用户名和密码是否正确、检查SQL服务是否开启、检查SQL端口号是否正确。。。
解决方案六:
明显是没连接到数据库吗,看下连接字符串有没有设置正确,然后再检查下数据库服务有没有开启,允不允许远程连接等
解决方案七:
1.先用这个用户在SQLSERVER登录下看看不能不能登录进去.2.再看看这个SQLSERVER的服务器远程端口有没打开。3.再看下这个用户的允许登录数量是同时。