2010-11-10 167 views
2

我有一個活躍的SMO連接CREATE DATABASE命令失敗

 string server = textBox_Server.Text; 
     ServerConnection srvConn = new ServerConnection(server); 
     // Log in using SQL authentication instead of Windows authentication 
     srvConn.LoginSecure = false; 
     // Give the login username 
     srvConn.Login = textBox_userName.Text; 
     // Give the login password 
     srvConn.Password = textBox_Password.Text; 
     // Create a new SQL Server object using the connection we created 
     srvSql = new Server(srvConn); 

我可以看到有現有的數據庫及其信息。 但是當我嘗試創建一個新的數據庫

Database myDatabase = new Database(srvSql, "MyNewDatabase"); 
    myDatabase.Create(); 

我正在一個FailedOperationExeption,任何想法,爲什麼?當我創建一個新的數據庫時,我做錯了什麼。我怎麼能解決它...

感謝您的幫助。

回答

0

失敗的操作是否有內部異常?他們通常會提供更多信息。

如果沒有,嘗試運行SQL服務器上的探查和檢查命令執行.NET和響應的服務器發回...

+0

我的問題是w7_64問題 – 2010-11-10 14:16:47

+0

HTTP找到解決辦法://社會。 msdn.microsoft.com/Forums/en/sqlsmoanddmo/thread/861b57bc-aa21-4b03-bd01-5c164e2bac4e – 2010-11-10 14:20:13