<html>
<head>
<title>ACCESS數據庫壓縮程序</title>
</head>
<body bgcolor="e0f8ef">
<div>
<div align="center"><font color="#3300FF"><b><font size="5">通用ACCESS數據庫在線壓縮程序</font></b></font><br>
</div>
<div><br>
本程序其實是通過FSO權限和JET引擎連接,因此在使用之前請確認你的服務器支持FSO(filesystemobject)權限並安裝的ACCESS最新驅動!從安全出發,請在壓縮之前備份原始數據庫!</div><br>
<div align="center">運行環境:在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, _
"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 = "你的數據庫, " & dbpath & ", 已經被壓縮" & vbCrLf
Else
CompactDB = "你輸入的數據庫路徑或名稱未找到,請重試" & 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">壓縮選項,請仔細填寫!</font></b><br>
<br>
輸入數據庫全稱:
<input type="text" name="dbpath">
(包括擴展名,如MDB、ASA、ASP等)<br>
<br>
<input type="checkbox" name="boolIs97" value="True">
檢查是否為ACCESS97數據庫<br>
(默認為ACCESS2000的數據庫)<br>
<br>
<input type="submit" name="submit" value="確認壓縮">
</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>
</html>