<! -- # Include file = "config. asp" -->
<! -- # Include file = "fun. asp" -->
<%
'Database Management
Class datas
'Backup
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 ('backup successful! '); Window. Location. href = 'datamanage. asp'
// --> </SCRIPT> ")
End sub
'Restore
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 ('success: You have successfully recovered the database! '); Window. Location. href = 'datamanage. asp? Action = RT'
// --> </SCRIPT> ")
Else
Response. Write ("<script language = JavaScript> <! --
Alert ('failed: Check whether the path and database name exist '); window. Location. href = 'datamanage. asp? Action = RT'
// --> </SCRIPT> ")
End if
End sub
'Compression
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 ('success: the database has been compressed successfully! '); Window. Location. href = 'datamanage. asp? Action = Dc'
// --> </SCRIPT> ")
Else
Response. Write ("<script language = JavaScript> <! --
Alert ('failed: Database compression failed. Check whether the path and database name exist! '); Window. Location. href = 'datamanage. asp? Action = Dc'
// --> </SCRIPT> ")
End if
End sub
End Class
%>