<!--#include file="admin_cook.asp"-->
<!--#include file="inc/Function.asp"-->
<%
Function CompactDB(dbPath, boolIs97)
Dim fso, Engine, strDBPath, JET_3X
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
Succeed("<li>压缩数据库成功 !<li>您压缩的数据库路径为：<br>&nbsp;&nbsp;&nbsp;" & dbpath & "") 
Else
ReturnError("数据库名称或路径不正确. 请重试!")
End If
End Function
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>∷ 管理中心 ≡ 数据库压缩 ∷</title>
<LINK href="Images/style.css" type=text/css rel=stylesheet>
</head>
<body leftmargin=0 bottommargin=0 rightmargin=0 topmargin=0>
<BR style="OVERFLOW: hidden; LINE-HEIGHT: 3px">
<table align=center border=0 cellspacing=1 cellpadding=2 class=tableBorder>
<tr>
<th>压缩数据库 ( 需要FSO支持，FSO相关帮助请看微软网站 )</th>
</tr>
<form method="post" action="">
<tr>
<td class="TableRow2"><b>注意：</b><br>输入数据库所在相对路径,并且输入数据库名称</td>
</tr>
<tr>
<td class="TableRow2">压缩数据库：<input type=text name="dbpath" size=45 value="../txq/txq.mdb">
&nbsp;<input type="submit" value="开始压缩" class=Button></td>
</tr>
<tr>
<td class="TableRow2"><input type="checkbox" name="boolIs97" value="True"> 如果使用 Access 97 数据库请选择(默认为 Access 2000 数据库)<br><br></td>
</tr>
<form>
</table>
</body>
</html>
<%   
Dim dbpath,boolIs97   
dbpath = request("dbpath")   
boolIs97 = request("boolIs97")   

If dbpath <> "" Then   
dbpath = server.mappath(dbpath)    
response.write(CompactDB(dbpath,boolIs97))    
End If   
%>   