admin_compressdata.asp
来自「完整的网址站」· ASP 代码 · 共 107 行
ASP
107 行
<!--#include file="config.asp"-->
<%
dim founderr,errmsg
founderr=false
errmsg=""
if session("adminlogin")<>sessionvar then
founderr=true
errmsg=errmsg+"<br>"+"<li>你尚未登录,或者超时了!请<a href='index.asp'>重新登录</a>!"
call diserror()
response.end
end if
if session("flag")>1 then
errmsg=errmsg+"<br>"+"<li>你的管理权限不够!!</a>!"
call diserror()
response.end
end if
if Request("action")="Backup" then
call backupdata()
else
dim rs,sql
dim tmprs
dim allarticle
dim Maxid
dim topic,username,dateandtime,body
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(""&fsoset&"")
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
errmsg = "<li>你的数据库已经压缩成功!<br>"
errmsg = errmsg & dbpath
call disok()
response.end
else
errmsg = "<li>压缩过程中出现错误,具体出错如下:<br>"
errmsg = errmsg & Err.Description
err.clear
call diserror()
response.end
end if
Set fso = nothing
Set Engine = nothing
Else
response.write "<li>数据库名称或路径不正确. 请重试!"
call diserror()
response.end
End If
End Function
%>
<html>
<head>
<title>管理中心</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK REL="stylesheet" HREF="css.css" TYPE="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" MARGINHEIGHT="0"><script>if(top==self)top.location="index.asp" </script>
<br><script>if(top==self)top.location="index.asp" </script>
<table align="center" width="96%" border="1" cellspacing="0" cellpadding="1" bordercolor="#0099CF" style="border-collapse: collapse">
<form action="" name="form1" method="post">
<tr>
<td height="25" colspan="2" align="center" bgcolor="#0099CF"><b>数 据 库 压 缩</b> </td>
</tr>
<tr valign="middle">
<td bgcolor="#ffffff"><br>
<b>注意:</b>( 需要FSO支持,FSO相关帮助请看微软网站 ) <br>输入数据库所在相对路径,并且输入数据库名称(<font color="red">正在使用中数据库不能压缩,请选择备份数据库进行压缩操作</font>)
<br>
压缩数据库:
<input name="dbpath" type="text" class="smallInput" value=../DataBackup/data.mdb size="30">
<br><br>
<input type="submit" value="开始压缩" class="button">
<BR>
<br>
<input type="checkbox" name="boolIs97" value="True">如果使用 Access 97 数据库请选择
(默认为 Access 2000 数据库)<br><br> </td>
</tr>
</form>
</table>
<%end if%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?