<%
‘数据库管理类
class Datas
‘备份
public sub Bk()
Set fso=server.createobject(“scripting.filesystemobject”)
fso.CopyFile Server.MapPath(SiteDataPath),Server.MapPath(SiteDataBakPath)
     set fso=nothing
response.Write(“<!–
alert(‘备份成功!’);window.location.href=’DataManage.asp’
// –>”)
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(“<!–
alert(‘成功:你已经成功恢复数据库!’);window.location.href=’DataManage.asp?action=rt’
// –>”)
else
         response.Write(“<!–
alert(‘失败:请检查路径和数据库名是否存在’);window.location.href=’DataManage.asp?action=rt’
// –>”)
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(“<!–
alert(‘成功:数据库已经压缩成功!’);window.location.href=’DataManage.asp?action=dc’
// –>”)
else
     response.Write(“<!–
alert(‘失败:数据库压缩失败,请检查路径和数据库名是否存在!’);window.location.href=’DataManage.asp?action=dc’
// –>”)
end if
    end sub     
end class
%>