سلام این کد های بک آپ و رستور برنامه منه هر دوش اررور میده.
کمککککککککککککککککککککککک ککک
واسه بک آپ :
private void btn_backup_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"data source=.; initial catalog=dabirkhane; integrated security=true");
SqlCommand com = new SqlCommand("backup Database dabirkhane to disk='" + txt_path_backup.Text + "'", con);
con.Open();
int result = com.ExecuteNonQuery();
if (result > 0)
MessageBox.Show("backup compelete.");
con.Close();
}
واسه رستور :
private void btn_restore_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"data source=.; initial catalog=dabirkhane; integrated security=true");
SqlCommand com = new SqlCommand("Restore Database dabirkhane From disk ='"+txt_path_restore.Text+"'"+"With File=1,Norecovery'" , con);
con.Open();
int result = com.ExecuteNonQuery();
if (result > 0)
MessageBox.Show("Restore compelete.");
con.Close();
}