baraye back up in javab mideh
man hamisheh azash estefadeh mikonam ama restor moshkel darem

private void back(string strFileName)
{
try
{
string command = "BACKUP DATABASE DB_Gold TO DISK = N'" + strFileName + "' WITH NOFORMAT, NOINIT, NAME = N'accounting-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10";
this.Cursor = Cursors.WaitCursor;
SqlCommand oCommand = null;
SqlConnection oConnection = null;

string scnn = Mahdi_Conection.Sql.ConectionString;
//"Data Source=.;Initial Catalog=DB_World_Water_Settle;Integrated Security=True";
oConnection = new SqlConnection(scnn);
if (oConnection.State != ConnectionState.Open)
oConnection.Open();
oCommand = new SqlCommand(command, oConnection);
oCommand.ExecuteNonQuery();
this.Cursor = Cursors.Default;
oConnection.Close();
MessageBox.Show("تهيه نسخه پشتيبان از اطلاعات با موفقيت انجام شد", "پشتیبانی");
Mahdi_Conection.Sql.Disconection();
}
catch (System.Data.SqlClient.SqlException ex)
{
MessageBox.Show(ex.Message);
}
finally
{
Mahdi_Conection.Sql.Disconection();
}
}
private void btnBackup_Click(object sender, EventArgs e)
{
string strFileName = string.Empty;
saveFileDialog1.DefaultExt = "BAK";
saveFileDialog1.FileName = "BackFile";
saveFileDialog1.Filter = "Create BackUp (*.bak)|*.bak|All file(*.*)|*.*";
saveFileDialog1.FilterIndex = 1;
saveFileDialog1.OverwritePrompt = true;
saveFileDialog1.Title = "Backup SQL File";
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
strFileName = saveFileDialog1.FileName;
back(strFileName);
}
}