asp Access数据备份,还原,压缩类代码_ASP教程-查字典教程网
asp Access数据备份,还原,压缩类代码
asp Access数据备份,还原,压缩类代码
发布时间:2016-12-29 来源:查字典编辑
摘要:

<>

<>

<%

'数据库管理类

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><></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><></script>")

else

response.Write("<script language=javascript><></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><></script>")

else

response.Write("<script language=javascript><></script>")

end if

end sub

end class

%>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新ASP教程学习
    热门ASP教程学习
    编程开发子分类