ASP Online Backup Access database program

Source: Internet
Author: User
Tags compact access database

If you delete data or objects in an Access database, or if you delete an object in an Access project, an Access database or an Access project can cause fragmentation and reduce the efficiency of disk space usage. Compressing an Access database or an Access project actually copies the file and organizes how the file is stored on disk. Compression also optimizes the performance of Access databases and Access projects.

So we think of compressing it when we're too slow to tolerate an ASP program that's growing in the database. But the usual way to download him to the local and then use MSAccess to complete the compression operation, and then upload!

Note: This program is actually through the FSO permissions and the Jet engine connection, so before using, please confirm your server support FSO (FileSystemObject) permissions and install the latest driver of access! From a safe start, please back up the original database before compacting! The running environment that has been tested through:

WIN98SE+PWS, win2000+iis5.0

The following is my collation of the source code, copy saved as Compact.asp and uploaded to the database directory can be used normally.


<title>access Database Compression Program </title>
<body bgcolor= "E0f8ef" >
<div>
<div align= "center" ><font color= "#3300FF" >
<b><font size= "5" > Universal Access Database online compression program </font></b></font><br>
</div>
<div><br>
This program is actually through the FSO permissions and the Jet engine connection,
So make sure your server supports the FSO before using it
(filesystemobject) Permissions and install the latest drivers for access!
From a safe start, please back up the original database before compacting! </div><br>
<div align= "center" > Operating Environment: In WIN98SE+PWS, win2000+iis5.0 <br>
<%
Const jet_3x = 4
Function Compactdb (DBPath, BOOLIS97)
Dim FSO, Engine, Strdbpath
Strdbpath = Left (Dbpath,instrrev (DBPath, ""))
Set fso = CreateObject ("Scripting.FileSystemObject")

If FSO. FileExists (DBPath) Then
Set Engine = CreateObject ("JRO. JetEngine ")

If boolIs97 = "True" Then
engine.compactdatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & DBPath, _< br> "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Strdbpath & "Temp.mdb" _
& "Jet oledb:engine Type= "& jet_3x
Else
engine.compactdatabase" Provider=Microsoft.Jet.OLEDB.4.0;Data source= & DBPath, _
" Provider=Microsoft.Jet.OLEDB.4.0;Data source= "& Strdbpath &" Temp.mdb "
End If
FSO. CopyFile Strdbpath & "Temp.mdb", DBPath
FSO. DeleteFile (Strdbpath & "Temp.mdb")
Set fso = Nothing
Set Engine = Nothing
Compactdb = "Your database," & DBPA Th & ", has been compressed" & vbCrLf
Else
Compactdb = "The database path or name you entered is not found, please retry" & vbCrLf
End If

End Function
%>
</div>
</div>
<form name= "compact" method= "POST" action= " Compact.asp ""
<div align= "center"
<font size= "2" ><b><font color= "#FF0000"
Compression options, please carefully fill out! </font></b><br>
<br>
Enter the full name of the database:
<input type= "text" name= "DBPath"
(including extension , such as MDB, ASA, ASP, etc.) <br>
<br>
<input type= "checkbox" Name= "boolIs97" value= "True"
Check for ACCESS97 database <br>
(default is ACCESS2000 database) <br>
<br>
<input type= "Submit" Name= " Submit "value= confirm Compression"
</font></div>
</form>
<div align= "center" ><font Size = "2"
<%
Dim dbpath,boolis97
DBPath = Request ("DBPath")
BoolIs97 = Request ("boolIs97")

If dbpath <> "Then
DBPath = Server.MapPath (dbpath)
Response.Write (Compactdb (DBPATH,BOOLIS97))
End If
%>
<br>
</font></div></body>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.