【问题标题】:Create database command failing创建数据库命令失败
【发布时间】: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


    【解决方案1】:

    失败的操作是否有内部异常?他们通常会处理更多信息。

    如果没有,请尝试在 SQL 服务器上运行分析器并检查 .Net 执行的命令以及服务器发回的响应...

    【讨论】:

    猜你喜欢
    • 2017-03-08
    • 1970-01-01
    • 2022-11-23
    • 2019-09-07
    • 2019-02-11
    • 2023-03-24
    • 1970-01-01
    • 2021-05-25
    • 1970-01-01
    相关资源
    最近更新 更多