网络编程 
首页 > 网络编程 > 浏览文章

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

(编辑:jimmy 日期: 2024/5/9 浏览:3 次 )
<!--#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 fso操作类
下一篇:ASP+FSO生成的网页文件默认编码格式以及转换成UTF-8编码方法
一句话新闻
高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网