备份文件及恢复文件[WEB学习实例]
2008-10-18 10:40
302 查看
protected void Button11_Click(object sender, EventArgs e)//备份
{ Bei_Fen_data(); }
protected void Bei_Fen_data()//备份
{
string DateTimes = System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString();
if (!File.Exists(Server.MapPath(@"~/DataBasc/" + "备份" + DateTimes + ".aspx")))
{
File.Copy(Server.MapPath(@"~/Data/So.aspx"), Server.MapPath(@"~/DataBasc/" + "备份" + DateTimes + ".aspx"));
System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "tixin", "alert('备份成功。')", true);
}
else { System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "tixin", "alert('备份失败?')", true); }
}
protected void Button12_Click(object sender, EventArgs e)//还原
{
File.Copy(Server.MapPath(@"~/DataBasc/" + DropDownList8.Text), Server.MapPath(@"~/Data/So.aspx"), true);
System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "tixin", "alert('恢复成功。')", true);
}
{ Bei_Fen_data(); }
protected void Bei_Fen_data()//备份
{
string DateTimes = System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString();
if (!File.Exists(Server.MapPath(@"~/DataBasc/" + "备份" + DateTimes + ".aspx")))
{
File.Copy(Server.MapPath(@"~/Data/So.aspx"), Server.MapPath(@"~/DataBasc/" + "备份" + DateTimes + ".aspx"));
System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "tixin", "alert('备份成功。')", true);
}
else { System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "tixin", "alert('备份失败?')", true); }
}
protected void Button12_Click(object sender, EventArgs e)//还原
{
File.Copy(Server.MapPath(@"~/DataBasc/" + DropDownList8.Text), Server.MapPath(@"~/Data/So.aspx"), true);
System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "tixin", "alert('恢复成功。')", true);
}
相关文章推荐
- Oracle的学习四:数据库管理员、逻辑备份与恢复、数据字典、动态性能视图、管理表空间与数据文件
- 类文件的建立与写法及调用[WEB学习实例]
- 显示指定文件夹中的所有文件并提供下载[WEB学习实例]
- ORACLE基础学习-RMAN应用--归档模式有备份,丢失数据文件恢复
- ORACLE基础学习-RMAN应用之(归档模式无备份,丢失数据文件的恢复)
- 导出excel文件问题[WEB学习实例]
- java resteasy restful webservice教程(六):实现文件下载功能实例文章来源:爱上123 原文地址:http://www.ishang123.com/jishubowen/
- ARCHIVELOG模式下用户管理的不完全恢复—基于备份控制文件的不完全恢复
- oracle数据恢复案例 - 控制文件损坏,无备份
- 系统数据文件备份与恢复及只读数据文件备份与恢复
- SQLServer 备份和恢复出现错误 鏃文件缺少
- RMAN 备份与恢复 实例
- CodeIgniter web框架学习(1)-- view、controller之间的关系,及静态页面的加载实例
- Ext2文件恢复实例分析
- Oracle学习(11)---使用rman备份进行数据库的恢复
- MongoDB 导出导入备份恢复数据实例
- Spring MVC Junit测试实例 附:读取WEB-INF下配置文件的方法
- [Redis学习笔记]-Redis 数据备份与恢复
- Oracle参数文件的备份与恢复
- Java EE学习笔记 II——Web应用和web.xml文件