Data Compression, backup, restoration, download, and deletion of ACCESS databases
Data Compression, backup, restoration, download, and deletion of ACCESS databases
The Code is as follows:
Database Management
Database Management System
<%
Dim ZC_DATABASE_PATH
'Database path
ZC_DATABASE_PATH = "database/data. mdb"
Data_array = Split (ZC_DATABASE_PATH ,"/")
Dim action
Action = trim (request ("action "))
Dim dbpath, bkfolder, bkdbname, fso, fso1
Select Case action
Case ""
Call chushihua ()
Case "CompressData" ': compressing data
Dim tmprs
Dim allarticle
Dim Maxid
Dim topic, username, dateandtime, body
Call CompressData ()
Case "BackupData" 'Back Up data
If request ("act") = "Backup" Then
Call updata ()
Else
Call BackupData ()
End If
Case "RestoreData" 'restore Data
Dim backpath
If request ("act") = "Restore" Then
Dbpath = request. form ("Dbpath ")
Backpath = request. form ("backpath ")
If dbpath = "" Then
Response. write "Please input your database whole Name"
Else
Dbpath = server. mappath (Dbpath)
End If
Backpath = server. mappath (backpath)
Set Fso = server. CreateObject ("scripting. filesystemobject ")
If fso. fileexists (dbpath) Then
Fso. copyfile Dbpath, Backpath
Response. write "the database is restored successfully!
"
Else
Response. write "the database you need is not found! "
End If
Else
Call RestoreData ()
End If
Case "SpaceSize" 'system space usage
Call SpaceSize ()
Case "deletebackup"
Dim dbname
Dbpath = Request. QueryString ("dbpath ")
Dbname = Request. QueryString ("dbname ")
Dbpath = Server. MapPath (dbpath)
Dbpath = dbpath & "\" & dbname
Set fso = CreateObject ("Scripting. FileSystemObject ")
If fso. FileExists (dbPath) Then
Fso. DeleteFile (DBPath)
Set fso = nothing
Response. write"
The database you backed up has been "& dbpath &" deleted!
Return .."
Else
Response. write dbpath
Response. write"
The entered path is incorrect. Please confirm and enter it again!
Return .."
End If
Case Else
End Select
%>
<%
Response. write""
Sub chushihua ()
%>
<% End sub %>
<%
'================================ System space usage ======================== ========
Sub SpaceSize ()
On Error Resume Next
%>
View system space
Return...
<%
End Sub
%>
<% Sub ShowSpaceInfo (drvpath)
Dim fso, d, size, showsize
Set fso = server. CreateObject ("scripting. filesystemobject ")
Drvpath = server. mappath (drvpath)
Set d = fso. getfolder (drvpath)
Size = d. size
Showsize = size & "Byte"
If size & gt; 1024 Then
Size = (Size/1024)
Showsize = size & "KB"
End If
If size & gt; 1024 Then
Size = (size/1024)
Showsize = formatnumber (size, 2) & "MB"
End If
If size & gt; 1024 Then
Size = (size/1024)
Showsize = formatnumber (size, 2) & "GB"
End If
Response. write "" & showsize &""
End Sub
%>
<%
Sub RestoreData ()
%>
<...