我正在尝试创建备份。我不明白我得到的错误是什么。哪找不到?!
这是错误消息: http://img717.imageshack.us/img717/1772/sql1.jpg
我的代码:
public void BackupDatabase(String destinationPath)
{
try
{
//MY SERVER
String userName = "NNIT-Admin";
String password = "password";
String serverName = @"RITZEL-PC\SQLEXPRESS";
ServerConnection connection = new ServerConnection(serverName, userName, password);
Server sqlServer = new Server(connection);
Backup BackupMgr = new Backup();
BackupMgr.Devices.AddDevice(destinationPath, DeviceType.File);
BackupMgr.Database = @"RITZEL-PC\SQLEXPRESS\Databases\D:\MY_THESIS\WORKING FILES\NNIT-RMS.MDF";
BackupMgr.Action = BackupActionType.Database;
BackupMgr.SqlBackup(sqlServer);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + " " + ex.InnerException);
}
}
private void BackUp_Btn_Click(object sender, EventArgs e)
{
String destinationPath = @"D:\";
BackupDatabase(destinationPath);
}
答案 0 :(得分:1)
根据a quick Google search,您需要安装64位SMO组件:
我在这里找到了解决方案:
下载并安装
X64包(SQLServer2005_XMO_x64.msi) - 14675 KB
这将安装64位smo对象。