systemManage/dataBackup.aspx.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DbBackUp;
using System.IO;
using System.Data.SqlClient;
public partial class systemManage_dataBackup : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public static void FileDownload(string FileName)
{
//String FullFileName = System.Web.HttpContext.Current.Server.MapPath(FileName);
FileInfo DownloadFile = new FileInfo(FileName);
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.ClearHeaders();
System.Web.HttpContext.Current.Response.Buffer = false;
System.Web.HttpContext.Current.Response.ContentType = "application/octet-stream";
System.Web.HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.UTF8));
System.Web.HttpContext.Current.Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
System.Web.HttpContext.Current.Response.WriteFile(DownloadFile.FullName);
System.Web.HttpContext.Current.Response.Flush();
DownloadFile.Delete();
System.Web.HttpContext.Current.Response.End();
}
protected void btn_Submit_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Server=.;Database=master;User ID=sa;Password=sa123;");
SqlCommand cmdBK = new SqlCommand();
cmdBK.CommandType = CommandType.Text;
cmdBK.Connection = conn;
cmdBK.CommandText = @"backup database tuShuFuZhu_system to disk='D:\backup' with init";
try
{
conn.Open();
cmdBK.ExecuteNonQuery();
Response.Write("<script>alert('数据库备份成功!')</script>");
}
catch (Exception ex)
{
Response.Write("<script>alert('您的数据库不支持备份权限.')</script>");
}
finally
{
conn.Close();
后面还有 10 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
