2011-04-08 102 views
0

我在asp.net中創建學校項目http://msdn.microsoft.com/en-us/library/bb399731.aspx當我在management studio中運行sql來創建數據庫時,它說我無法在主數據庫中創建該數據庫。 我得到這個錯誤「權限被拒絕在數據庫'主''」。我按照鏈接此錯誤,但沒有文件在SQLServer Management Studio 2008中創建數據庫時出錯

 
TITLE: Microsoft SQL Server Management Studio 
------------------------------ 

Create failed for Database 'School'. (Microsoft.SqlServer.Smo) 

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1447.4+((KJ_RTM).100213-0103+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Database&LinkId=20476 

------------------------------ 
ADDITIONAL INFORMATION: 

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) 

------------------------------ 

CREATE DATABASE permission denied in database 'master'. (Microsoft SQL Server, Error: 262) 

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=262&LinkId=20476 

------------------------------ 
BUTTONS: 

OK 
------------------------------ 


=================================== 

Create failed for Database 'School'. (Microsoft.SqlServer.Smo) 

------------------------------ 
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1447.4+((KJ_RTM).100213-0103+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Database&LinkId=20476 

------------------------------ 
Program Location: 

    at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImpl() 
    at Microsoft.SqlServer.Management.Smo.Database.Create() 
    at Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseData.DatabasePrototype.ApplyChanges(Control marshallingControl) 
    at Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabase.DoPreProcessExecution(RunType runType, ExecutionMode& executionResult) 
    at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.DoPreProcessExecutionAndRunViews(RunType runType) 
    at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.ExecuteForSql(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult) 
    at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.Microsoft.SqlServer.Management.SqlMgmt.IExecutionAwareSqlControlCollection.PreProcessExecution(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult) 
    at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.RunNow(RunType runType, Object sender) 
+0

您需要創建數據庫的dbcreator權限......您是否以DBAdmin身份登錄? – sajoshi 2011-04-08 09:28:23

回答

1

您是登錄與Windows憑據或「sa」帳戶?我推薦使用服務器登錄(使用sa帳戶並通過您在安裝過程中提供的)而不是Windows驗證。

如果您成功通過Windows身份驗證登錄,您擁有安全選項。展開安全性 - >登錄,您將看到包括sa的所有用戶。右鍵點擊它並選擇propierties。您可以選擇設置密碼。

+0

你可以給我的步驟做到這一點,因爲我不太瞭解所有這個服務器和登錄設置。我只是設置默認的方式did'nt提示我關於任何帳戶等。我登錄使用我的計算機名稱,然後單擊連接 – ONYX 2011-04-08 09:42:36

+0

我是否必須重新安裝SqlServer? – ONYX 2011-04-08 09:47:50

相關問題