BackUp Code in LinQ : string str_filename = ""; SaveFileDialog sfd = new SaveFileDialog(); sfd.FileName = DateTime.Now.ToString("ddmmyyyy"); sfd.Filter = "BackUp Files(*.bak)|*.bak"; if (sfd.ShowDialog() == DialogResult.OK) { str_filename = sfd.FileName; try { db.ExecuteCommand("USE master; BACKUP DATABASE " + db_name + " TO DISK ='" + str_filename + "'"); MessageBox.Show("پشتيباني گيري با موفقيت انجام شد", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } Restore Code in LinQ : string str_filename = ""; OpenFileDialog opd = new OpenFileDialog(); opd.Filter = "BackUp Files (*.bak)|*.bak"; if (opd.ShowDialog() == DialogResult.OK) { str_filename = opd.FileName; try { db.ExecuteCommand("USE master; RESTORE DATABASE " + db_name + " FROM DISK = '" +str_filename+ "'"); MessageBox.Show("عمليات بازيابي با موفقيت انجام شد", "", MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Restart(); } catch (Exception ex) { MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information); } }