【发布时间】:2010-11-10 14:02:54
【问题描述】:
我有一个有效的 SMO 连接
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 ,知道为什么吗?创建新数据库时我做错了什么。以及我该如何解决它...
感谢您的帮助。
【问题讨论】:
标签: c# .net sql-server sql-server-2005 smo