📄 compressdata.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link href="img/Style.css" rel="stylesheet" type="text/css" />
</head>
<!-- #include file="const.asp" -->
<body>
<p>
<%
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.write(CompactDB)
response.end
else
errmsg = "<li>压缩过程中出现错误,具体出错如下:<br>"
errmsg = errmsg & Err.Description
err.clear
response.Write(errmsg)
response.end
end if
Set fso = nothing
Set Engine = nothing
Else
CompactDB = "<li>数据库名称或路径不正确. 请重试!"
response.Write(CompactDB)
response.end
End If
End Function
%>
</p>
<p> </p>
<p> </p>
<p> </p>
<table width="76%" border="0" align="center" cellpadding="6" cellspacing="2" class="atable1">
<form action="Compressdata.asp" name="form1" method="post">
<tr>
<td colspan="2" align="center" height="20" > 系统数据压缩 </td>
</tr>
<tr valign="middle">
<td><p><br />
<span class="red">注意:</span>( 需要FSO支持,FSO相关帮助请看微软网站 ) <br />
输入数据库所在相对路径和数据库名称<br />
<font color="red">正在使用中数据库不能压缩,请选择备份数据库进行压缩操作</font><br />
压缩数据库:
<input name="dbpath" type="text" class="atable1" value="<%=dbph%>" size="40">
<br />
<br />
<input type="submit" value="开始压缩" class="atable1">
<br />
<br />
<input type="checkbox" name="boolIs97" value="True">
如果使用 Access 97 数据库请选择
(默认为 Access 2000 数据库)<br />
<br />
</p>
</td>
</tr>
</form>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -