Beispiel #1
0
 private void btnSaoLuu_Click(object sender, EventArgs e)
 {
     if (saoLuu)
     {
         if (bd.ThucThiSaoLuuDulieu(ref err, ref count, txtpath.Text))
         {
             MessageBox.Show("Sao lưu thành công");
             this.Close();
         }
     }
     else
     {
         string sql = string.Format("USE Master \n ALTER DATABASE {0} SET SINGLE_USER WITH ROLLBACK IMMEDIATE" + " RESTORE DATABASE {1} FROM DISK = N'{2}' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10" + " ALTER DATABASE {3} SET MULTI_USER", ClsMain.DatabaseName, ClsMain.DatabaseName, txtpath.Text, ClsMain.DatabaseName);
         if (bd.ThucThiPhucHoiDulieu(ref err, ref count, sql))
         {
             MessageBox.Show("phục hồi thành công");
             this.Close();
         }
     }
 }