作家
登录

asp Access数据备份,还原,压缩类代码

作者: 来源:www.28hudong.com 2013-03-30 08:20:07 阅读 我要评论

<!--#include file="config.asp" --> <!--#include file="Fun.asp" --> <% '数据库管理类 class Datas '备份 public sub Bk() Set fso=server.createobject("scripting.filesystemobject") fso.CopyFile Server.MapPath(SiteDataPath),Server.MapPath(SiteDataBakPath) set fso=nothing response.Write("<script language=javascript><!-- alert('备份成功!');window.location.href='DataManage.asp' // --></script>") end sub '还原 public sub Rt() SDPath = server.mappath(SiteDataPath) SDBPath = server.mappath(SiteDataBakPath) set Fso=Server.CreateObject("Scripting.FileSystemObject") if Fso.FileExists(SDBPath) then Fso.CopyFile SDBPath,SDPath Set Fso=nothing response.Write("<script language=javascript><!-- alert('成功:你已经成功恢复数据库!');window.location.href='DataManage.asp?action=rt' // --></script>") else response.Write("<script language=javascript><!-- alert('失败:请检查路径和数据库名是否存在');window.location.href='DataManage.asp?action=rt' // --></script>") end if end sub '压缩 public sub Dc() SDBPath = server.mappath(SiteDataBakPath) set Fso=Server.CreateObject("Scripting.FileSystemObject") if Fso.FileExists(SDBPath) then Set Engine =Server.CreateObject("JRO.JetEngine") if request("boolIs") = "97" then Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SDBPath, _ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SDBPath & "_temp.mdb;" _ & "Jet OLEDB:Engine Type=" & JET_3X else Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SDBPath, _ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SDBPath & "_temp.mdb" end if Fso.CopyFile SDBPath & "_temp.mdb",SDBPath Fso.DeleteFile(SDBPath & "_temp.mdb") set Fso = nothing set Engine = nothing response.Write("<script language=javascript><!-- alert('成功:数据库已经压缩成功!');window.location.href='DataManage.asp?action=dc' // --></script>") else response.Write("<script language=javascript><!-- alert('失败:数据库压缩失败,请检查路径和数据库名是否存在!');window.location.href='DataManage.asp?action=dc' // --></script>") end if end sub end class %>

  推荐阅读

  asp读取xml实例代码

language.xml 复制代码 代码如下: <?xml version="1.0" encoding="gb2312"?> <languageRoot> <!--简体中文--> <language> <LanguageName>简体中文</LanguageName> <LanguageValue>SimpilifiedChinese</LanguageVal>>>详细阅读


本文标题:asp Access数据备份,还原,压缩类代码

地址:http://www.17bianji.com/kaifa2/ASP/31979.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)