<!--#include file="../Inc/Consts.inc" -->
<!--#include file="../Inc/common.Asp" -->
<!--#include file="../Inc/sharefunc.Asp" -->
<!--#include file="CheckAdmin.Asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="Images/Admin_style.css">
<script language="javascript" src="Admin.js"></script>
<%
' Ss简单网站管理系统-开源版 
'晴天设计www.xxzwz.com
If InStr(SsMasterPurview, "|38,") = 0 Then
    response.Write "<center>您没有管理该模块的权限！</center>"
    response.End
End If
%>

<script language="javascript">
function seleChan(str){
    if(str=="varchar"){
        document.getElementById("charlen").style.display="";
    }
    else{
        document.getElementById("charlen").style.display="none";
    }
}
</script>
</head>
<body>
<table class="tableBorder" width="95%" border="0" align="center" cellpadding="5" cellspacing="1">
<%
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
%>
  <form  name="compress" method="post" action="SQLcompress.asp">
    <tr>
      <th height="22" colspan="2" sytle="line-height:150%">【压缩数据库】( 需要FSO支持，FSO相关帮助请看微软网站 ) </th>
    </tr>
    <tr>
      <td colspan="2" align="left" class="forumRow"><font color="#ff0000">注意：输入数据库所在相对路径,并输入数据库名称（正在使用中数据库不能压缩，选择备份数据库进行压缩）</font></td>
    </tr>
    <tr>
      <td width="10%" nowrap="nowrap" align="right" class="forumRow">压缩数据库：</td>
      <td class="forumRowHighlight"><input type=text size="34" name="DBpath" value="<%response.Write(".."&SysRootDir&SiteDataPath)%>">
        请正确添写您当前使用的数据库路径！</td>
    </tr>
    <tr>
      <td colspan="2" align="left" class="forumRow"><input type="checkbox" name="boolIs97" value="True">
如果使用 Access 97 数据库请选择（默认为 Access 2000 数据库）</td>
    </tr>
    <tr>
      <td class="forumRow"></td>
      <td class="forumRowHighlight"><input name="submitSaveEdit" type="submit" id="submitSaveEdit" value="开始压缩">
        <input type="button" value="返回上一页" onClick="history.back(-1)"></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
%>
</body>
</html>