创建数据库命令失败
我有一个活动的 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 ,知道为什么吗?当我创建新数据库时我做错了什么。我该如何解决它......
感谢您的帮助。
I have an active SMO connection
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);
I can see there existing databases and their information.
But when I try to create a new database
Database myDatabase = new Database(srvSql, "MyNewDatabase");
myDatabase.Create();
I am getting an FailedOperationExeption , any idea why ? what i am doing wrong when i create a new database . And how i can solve it ...
Thanks for help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
失败的操作是否有内部异常?他们通常会使用更多信息。
如果没有,请尝试在 SQL 服务器上运行探查器并检查 .Net 执行的命令以及服务器发回的响应...
Does the failed operation have an inner exception? They usually do with more information.
If not, try running the profiler on the SQL server and examine the commands .Net executing and the responses the server sends back...