标签:blog http io ar os sp 文件 数据 div
protected void Button1_Click(object sender, EventArgs e)
{
///
///备份方法
///
SqlConnection conn = new SqlConnection("Server=.; Database=aaaa; User ID=sa; Password=sa;");
SqlCommand cmdBK = new SqlCommand();
cmdBK.CommandType = CommandType.Text;
cmdBK.Connection = conn;
//bak为文件名,其他的不用管
cmdBK.CommandText = @"backup database test to disk=‘D:/bak‘with init";
try
{
conn.Open();
cmdBK.ExecuteNonQuery();
MessageBox.Show("Backup successed.");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
conn.Dispose();
}
}
标签:blog http io ar os sp 文件 数据 div
原文地址:http://www.cnblogs.com/ingstyle/p/4077899.html