private void button1_Click(object sender, EventArgs e) { con = new SqlConnection("Data Source = localhost; Initial Catalog=master ;Integrated Security = True;"); con.Open(); if (con.State == ConnectionState.Closed) con.Open(); string qry = "Restore database Peshawar_Children_Academy_Database from Disk= 'F:\\My.bak'"; com = new SqlCommand("use master", con); com.ExecuteNonQuery(); com = new SqlCommand(qry, con); com.ExecuteNonQuery(); con.Close(); MessageBox.Show("Has been restored database", "Restoration", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void button2_Click(object sender, EventArgs e) { con = new SqlConnection("Data Source=localhost;Initial Catalog=Peshawar_Children_Academy_DataBase;Integrated Security = True;"); con.Open(); string qry = "backup database Peshawar_Children_Academy_Database to disk ='F:\\My.bak' with init,stats=10"; com = new SqlCommand(qry, con); com.ExecuteNonQuery(); con.Close(); con.Dispose(); MessageBox.Show("The support of the database was successfully performed", "Back", MessageBoxButtons.OK, MessageBoxIcon.Information); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)