<%@language=vbscript codepage=936 %>
<%path="../basedata"%>
<!--#include file="../inc/function.asp"-->
<%call Loginpower%>
<%call legalpower%>
<!--#include file="../conn/conn_data.asp"-->

<!-- #include file="../inc/Head.asp" -->
<%
if request.querystring("action")="compact" then
%>
<br/><br/><br/><br/>
<div style="text-align:center;">
<table width="560" align="center" border="1" bordercolor="#A5B6D6" cellpadding="0" cellspacing="2" class="center">
        <tr>
          <td class="southidc" height="25"> <div align="center"><strong>压缩数据库</strong></div>
</td>
        </tr>
        <tr>
            <td><br>
              <table width="91%" border="0" align="center" cellpadding="0" cellspacing="2">
                <tr>
                  <td height="25">
                  <%

	Response.write "关闭所有连接...<br />"
	conn_data.close
	dim AccessFSO,AccessEngine
	if IsObjInstalled("Scripting.FileSystemObject") then
			set AccessFSO=server.createobject("Scripting.FileSystemObject")
			IF AccessFSO.FileExists(Server.Mappath(db_data)) Then
			Set Engine =server.CreateObject("JRO.JetEngine")
			Engine.CompactDatabase connstr_data ,"provider=microsoft.jet.oledb.4.0;data source="&server.mappath(db_data&".temp")
			Response.write "开始压缩和修复数据...<br />"
			AccessFSO.CopyFile server.mappath(db_data&".temp"),Server.Mappath(db_data)
			AccessFSO.DeleteFile server.mappath(db_data&".temp"),true
			Set AccessFSO = Nothing
			Set Engine = Nothing
			Response.write "压缩数据库完成"
		end If
	Else
		Response.write "<span style=""color:#ff0000;"">压缩数据库失败，服务器不支持FSO</span>"
	End if

                  %></td>
                </tr>
              </table></td>
        </tr>
      </table></div>

<%
else
%>
<br/><br/><br/><br/>
<div style="text-align:center;">
<table width="560" align="center" border="1" bordercolor="#A5B6D6" cellpadding="0" cellspacing="2" class="center">
        <tr>
          <td class="southidc" height="25"> <div align="center"><strong>压缩数据库</strong></div>
</td>
        </tr>
        <tr class="tr_southidc">
          <form method="post" action="?action=compact">
            <td><br>
              <table width="91%" border="0" align="center" cellpadding="0" cellspacing="2">
                <tr>
                  <td height="25"><strong>压缩数据库文件</strong>[需要FSO权限]</td>
                </tr>
                <tr>
                  <td height="22"> 当前数据库路径</td>
                </tr>
                <tr>
                  <td height="22"><input type="text" size="50" name="DBpath" value="data/data.mdb"></td>
                </tr>
                <tr>
                  <td height="22"><div align="center">
                      <input type="submit" value="确定">
                    </div></td>
                </tr>
                <tr>
                  <td height="22"><br> <br>
                    本程序的默认数据库文件为data/data.mdb<br>
                    您可以用这个功能来压缩您的数据，可以有效地释放无效空间，加快访问速度<br>
                    注意：所有路径都是相对与程序空间根目录的相对路径</td>
                </tr>
                <tr>
                  <td height="22">&nbsp;</td>
                </tr>
              </table></td>
          </form>
        </tr>
      </table></div>
      <%end if%>
<!-- #include file="../inc/Foot.asp" -->
