compress.asp

来自「网店批发系统,很好很强大,很好很强大很好很强大」· ASP 代码 · 共 91 行

ASP
91
字号
<!--#include file="conn.asp"-->
<!--#include file="checkAdmin.asp"-->
<!--#include file="inc/closeconn_inc.asp"-->
<link href="css/css.css" rel="stylesheet" type="text/css" />

<table class="tableBorder" width="97%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FAFAFA" style="border:1px solid #DDDDDD">
<tr>
  <td width="21" align="center" background="../images/admin_bg_1.gif">&nbsp;</td>
  <td align="center" background="../images/admin_bg_1.gif">&nbsp;</td>
</tr>
<tr>
  <td align="center" background="../images/admin_bg_1.gif">&nbsp;</td> 
<td height="24" background="../images/admin_bg_1.gif"><b>压缩数据库 ( 需要FSO支持,FSO相关帮助请看微软网站 )</b></td>
</tr>
<tr>
  <td width=21>&nbsp;</td>
<td height="24">
<font color=red>注意:此功能需要FSO组件支持,正在使用中数据库不能压缩,建议您选择备份数据库后再进行压缩操作</font></td>
</tr>
<%

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&";Jet OLEDB:Database Password=Ds5f@$h#^&E3#d$%5@$h", _
             "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&";Jet OLEDB:Database Password=Ds5f@$h#^&E3#d$%5@$h", _
	"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb;Jet OLEDB:Database Password=Ds5f@$h#^&E3#d$%5@$h"
       End If
       fso.CopyFile strDBPath & "temp.mdb",dbpath
       fso.DeleteFile(strDBPath & "temp.mdb")
       Set fso = nothing
       Set Engine = nothing
       CompactDB = "您所指定的数据库已经成功压缩" & vbCrLf
Else
       CompactDB = "数据库路径或名称已被更改,未找到,请重试" & vbCrLf
End If

End Function
%>

<form name="compress" method="post" action="compress.asp">
<tr>
  <td width=21>&nbsp;</td>
<td height="50">
<span style="display:none;">压缩数据库:
  <input name="dbpath" type="text" class="editbox" value="../database/sldk2456fhQ#234$6$Qh/f5ls%$kdld$#%8f&/#asd$#@kf234hshop_db.asp" size="30"></span>
<input name="submit" type="submit" class="Button" value="开始压缩" onclick="return confirm('您确认这样操作吗?此操作将不可还原')"></td>
<td width="1" height="24"></tr>
<tr>
  <td width=21>&nbsp;</td>
<td height="24">
<input type="checkbox" name="boolIs97" value="True">
如果使用 Access 97 数据库请选择(默认为 Access 2000 数据库)</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
</tr>
</form>
</table>

<%
Dim dbpath,boolIs97
dbpath = request("dbpath")
boolIs97 = request("boolIs97")

If dbpath <> "" Then
dbpath = server.mappath(dbpath)
%>
<table class="tableBorder" width="97%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FAFAFA" style="border:1px solid #DDDDDD;margin-top:20px;">
<tr>
<td align="center" height="100" style="font-size:16px;font-weight:bold;color:#3565B7;"><%response.write(CompactDB(dbpath,boolIs97))%>
</td>
</tr>
</table>
<%
End If
%>
</body>
</html>

⌨️ 快捷键说明

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