我正在尝试使用此代码恢复SQL数据库备份
private void btnRestore_Click(object sender, EventArgs e)
{
string dbName = "BakodahDB";
try
{
Server dbServer = new Server(); //local using windows athuentication
Restore dbRestore = new Restore() { Database = dbName, Action = RestoreActionType.Database, ReplaceDatabase = true, NoRecovery = false };
dbRestore.Devices.AddDevice(@"C:\WorkHours\dbBackup.bak", DeviceType.File);
dbRestore.PercentComplete += DbRestore_PercentComplete;
dbRestore.Complete += DbRestore_Complete;
dbRestore.SqlRestoreAsync(dbServer);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
当我点击按钮时没有任何反应,甚至没有错误信息...这是正确的方法吗?
答案 0 :(得分:3)
我只需要在恢复之前杀死所有进程
.fullCalendar()
有效!