2014-05-08 40 views
0

我用這個查詢關閉到SQL Server(Windows身份驗證)我關閉SQL連接和最多

alter database YourDb set single_user with rollback immediate 

所有的連接不能打開它回來,現在我得到我的web應用程序此錯誤

Cannot open database "DataCleanup" requested by the login. The login failed.
Login failed for user 'BIVAR\DEV_WEB_VM$'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Cannot open database "DataCleanup" requested by the login. The login failed.
Login failed for user 'BIVAR\DEV_WEB_VM$'.

源錯誤:

Line 91:     
Line 92:     { 
Line 93:      sqlCon2.Open(); 
Line 94:      { 
Line 95:       //PM3-PM5-PR 

我不知道如何再次打開每個人的連接?

+0

並關閉連接... – Hitsugaya

+0

你的DBA說什麼? –

+0

此帖可能有幫助 - http://stackoverflow.com/questions/14652923/set-database-from-single-user-mode-to-multi-user。 – bsivel

回答

0

您必須首先明確連接到不同的數據庫。我建議[master]或[tempdb]。然後你就可以打開它回來了:

alter database YourDb set multi_user; 

您現在遇到的問題,可能是你沒有明確指定DATABSE所以它要你的默認,這很可能是[YourDb。如果這個數據庫已經有一個連接(即使是你的連接),那麼你將無法建立連接。