Пример #1
0
        private void metroButton5_Click(object sender, EventArgs e)
        {
            String  command = "RESTORE DATABASE bisdb FROM DISK ='" + metroTextBox1.Text + "' WITH REPLACE";
            DataCon dc4     = new DataCon();

            dc4.openCon();
            SqlCommand cmd = new SqlCommand(command, dc4.getCon());

            dc4.closeCon();
            dc4.dispCon();
            MessageBox.Show("SuccessFully Restored");
        }
Пример #2
0
 private void metroButton4_Click(object sender, EventArgs e)
 {
     if (!((String.IsNullOrEmpty(metroTextBox4.Text) || (String.IsNullOrEmpty(metroTextBox5.Text)))))
     {
         sql = "BACKUP DATABASE bisdb TO DISK ='" + metroTextBox4.Text + "\\bisdb-" + metroTextBox5.Text + ".bak'";
         cmd = new SqlCommand(sql, dc.getCon());
         try
         {
             cmd.ExecuteNonQuery();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         dc.closeCon();
         dc.dispCon();
         MessageBox.Show("Successfully Backed up!");
     }
     else
     {
         MessageBox.Show("one or more empty fields. You cannot leave them blank!");
     }
 }