📄 admin_compressdata.asp
字号:
<!--#include file="admin_head.asp"-->
<br><br>
<%
dim rs,sql
dim tmprs
dim allarticle
dim Maxid
dim topic,username,dateandtime,body
Dim dbpath,boolIs97
dbpath = request("dbpath")
boolIs97 = request("boolIs97")
If dbpath <> "" Then
dbpath = server.mappath(dbpath)
response.write(CompactDB(dbpath,boolIs97))
End If
Const JET_3X = 4
Function CompactDB(dbPath, boolIs97)
Dim fso, Engine, strDBPath
strDBPath = left(dbPath,instrrev(DBPath,"\"))
Set fso = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
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")
if err.number="0" then
CompactDB = "你的数据库, " & dbpath & ", 已经压缩成功!" & vbCrLf
response.end
else
errmsg = "<li>压缩过程中出现错误,具体出错如下:<br>"
errmsg = errmsg & Err.Description
err.clear
call Qcdn.Err_List(errmsg,1)
response.end
end if
Set fso = nothing
Set Engine = nothing
Else
CompactDB = "<li>数据库名称或路径不正确. 请重试!"
Call Qcdn.Err_List(CompactDB,3)
response.end
End If
End Function
%>
<table width="95%" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#ECEEE4" bordercolordark="#CCCABC">
<form action="" name="form1" method="post">
<tr>
<td colspan="2" align="center" height="30" background="image/tablebg.gif"><b>文 章 数 据 压 缩</b> </td>
</tr>
<tr valign="middle">
<td><br>
<b>注意:</b>( 需要FSO支持,FSO相关帮助请看微软网站 ) <br>输入数据库所在相对路径,并且输入数据库名称(<font color="red">正在使用中数据库不能压缩,请选择备份数据库进行压缩操作</font>)
压缩数据库:
<input type="text" name="dbpath" value=data/qcdn_news.mdb class="smallInput">
<br><br>
<input type="submit" value="开始压缩" class="tbutton">
<BR><br><input type="checkbox" name="boolIs97" value="True">如果使用 Access 97 数据库请选择
(默认为 Access 2000 数据库)<br><br>
</td>
</tr>
</form>
</table>
<!--#include file="admin_copy.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -