Back Up with ADO : string str_filename = ""; SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "BackUp Files(*.bak)|*.bak"; sfd.FileName = DateTime.Today.Date.ToString("ddmmyyyy"); if (sfd.ShowDialog() == DialogResult.OK) { try { str_filename = sfd.FileName; string command = "USE master; BACKUP DATABASE db_name TO DISK ='" + str_filename + "'"; SqlConnection con = new SqlConnection(); SqlCommand cmd = new SqlCommand(); con.ConnectionString = "data source=.\\instance_name;initial catalog=db_name ;integrated security=true"; if (con.State != ConnectionState.Open) con.Open(); cmd.Connection = con; cmd.CommandText = command; cmd.Connection.Open(); cmd.ExecuteNonQuery(); cmd.Connection.Close(); MessageBox.Show("پشتيبان گيري با موفقيت انجام شد","",MessageBoxButtons.OK,MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message,"",MessageBoxButtons.OK,MessageBoxIcon.Information); } } Restore with ADO : string str_filename = ""; OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "BackUp Files(*.bak)|*.bak"; if (ofd.ShowDialog() == DialogResult.OK) { try { str_filename = ofd.FileName; SqlCommand cmd = new SqlCommand(); SqlConnection con = new SqlConnection("Data Source=.\\instance_name;Initial Catalog=db_name;Integrated Security=True"); cmd.Connection = con; cmd.CommandText = @"ALTER DATABASE db_name SET SINGLE_USER with ROLLBACK IMMEDIATE " + " USE MASTER " + " RESTORE DATABASE db_name from DISK='" + str_filename + "' with REPLACE"; cmd.Connection.Open(); cmd.ExecuteNonQuery(); cmd.Connection.Close(); MessageBox.Show("بازيابي اطلاعات با موفقيت انجام شد", "", MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Restart(); } catch (Exception ex) { MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information); } }