⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compact.asp

📁 admin/admin.asp是WAP的后台管理登陆页面
💻 ASP
字号:
<%
 if session("admin")="" then
  response.redirect "admin.asp"
  else
	if session("flag")>1 then
		response.write "<br><p align=center>您没有操作的权限</p>"
		response.end
	end if
  end if
%><%
option explicit
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
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<link rel="stylesheet" type="text/css" href="style.css">
<title>数据库在线压缩</title>
</head><body>
<p align="center">
<form action=compact.asp>
<table align="center" width="400" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#000000">
    <tr bgcolor="#E3E3E3" class="tdbg">
      <td width="100%" bgcolor="#999999" height="30" align="center" ><strong>请查看你输入的数据库路径包括名字是否正确</strong></td>
    </tr>
<tr bgcolor="#E3E3E3" class="tdbg">
      <td width="100%" bgcolor="#ffffff" height="30" align="center"><input type="text" name="dbpath" value="bcgook.asa"></td></tr>
<tr bgcolor="#E3E3E3" class="tdbg">
      <td width="100%" bgcolor="#ffffff" height="30" align="center"><input type="checkbox" name="boolIs97" value="True"> 检查如果是Access 97(默认为 Access 2000)</td></tr>
<tr bgcolor="#E3E3E3" class="tdbg">
      <td width="100%" bgcolor="#999999" height="30" align="center"><input type="submit" value="开始压缩"></td></tr>
</table>
<form>
<%
Dim dbpath,boolIs97
dbpath = request("dbpath")
boolIs97 = request("boolIs97")

If dbpath <> "" Then
dbpath = server.mappath(dbpath)
response.write(CompactDB(dbpath,boolIs97))
End If
%>
</p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -