admin_datacompact.asp
来自「全站生成htm静态页面」· ASP 代码 · 共 66 行
ASP
66 行
<%checkAdmin3%>
<!--#include file="conn.asp"-->
<!--#include file="function.asp"-->
<%set rs=nothing
conn.close
set conn=nothing
%>
<!--#include file="style.asp"-->
<table border="1" width="100%" cellspacing="0" cellpadding="1" Class="TableLine" style="border-collapse:collapse;">
<tr>
<td align=center valign=top>
<table border="1" width="100%" cellspacing="0" cellpadding="0" Class="TableLine" style="border-collapse:collapse;">
<tr>
<td width="100%" align="center" height="20" valign="middle" ><b>数据库压缩</b></td>
</tr>
<tr>
<td align="center" height="86" valign="middle">
<%
If not IsObjInstalled(ServerObject(9)) Then
Response.Write "<br><br><b><center><font color=red>你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能</font></center></b><br><br><br>"
Else
if request("action")="Compact" then
call CompactDate()
else
%>
压缩前,建议先备份数据库,以免发生意外错误。</td>
</tr>
<tr><form method="post" action="admin_DataCompact.asp?action=Compact">
<td align="center" height="30" valign="middle">
<input name="submit" type=submit value="确定">
<%End If
end if%>
</td>
</form></tr>
</table>
</td>
</tr>
</table>
<%
sub CompactDate
if database=0 then
Dim fso, Engine, strDBPath
strDBPath = left(dbPath,instrrev(DBPath,"\"))
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(dbPath) Then
Set Engine = CreateObject("JRO.JetEngine")
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb"
fso.CopyFile strDBPath & "temp.mdb",dbpath
fso.DeleteFile(strDBPath & "temp.mdb")
Set fso = nothing
Set Engine = nothing
response.write "数据库压缩成功!"
Else
response.write "数据库没有找到!"
End If
Else
response.write "压缩失败,数据库不是ACCESS!"
end if
end sub%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?