try
{
string strg = Application.StartupPath.ToString();
strg
= strg.Substring(0, strg.LastIndexOf("\\"));
strg
= strg.Substring(0, strg.LastIndexOf("\\"));
strg
+= @"\Data";
string sqltxt = @"BACKUP DATABASE db_MrCy TO Disk='" + strg + "\\" + txtpath.Text +".bak"+ "'";
SqlConnection conn
= BaseClass.DBConn.CyCon();
conn.Open();
SqlCommand cmd
= new SqlCommand(sqltxt, conn);
cmd.ExecuteNonQuery();
conn.Close();
if (MessageBox.Show("备份成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK)
{
this.Close();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}

  

相关文章:

  • 2021-06-02
  • 2021-08-18
  • 2022-01-17
  • 2021-12-26
  • 2021-06-12
  • 2022-01-13
猜你喜欢
  • 2021-11-21
  • 2021-12-15
  • 2021-06-03
  • 2021-08-06
  • 2022-12-23
  • 2021-09-12
  • 2021-08-16
相关资源
相似解决方案