📄 admin_db_compress.asp
字号:
<%
'===================================================================
'= ASP FILENAME : /admin/admin_info.asp
'= CREATED TIME : 2006-4-30
'= LAST MODIFIED: 2006-4-30
'= VERSION INFO : CCASP Framework Ver 2.0.1 ALL RIGHTS RESERVED BY www.cclinux.com
'= DESCRIPTION : 压缩数据库
'= Change Log:
'===================================================================
%>
<!-- #include file = "../inc/admin/include_admin_action_view.asp" -->
<!-- #include file = "./admin_inc.asp" -->
<%
'========================================================
'== Action参数设置
'========================================================
'== 页面名
Const CONST_PAGE_FILE = "admin/admin_db_compress.asp"
'== 页面标题/功能
Const CONST_PAGE_TITLE = "压缩数据库"
'== 功能函数名字空间
Const CONST_ACTION_FUNC = "DBCompCtl"
'== 相对根目录路径
GBL_strHomeURL = "../"
'== 页面构造
Call ActionBuild()
'== 在模板中引用的标签变量
Dim TAG_objRS '== 列表记录集
'== 请求校验与过滤
Call ActionViewFilterAdmin(CONST_PAGE_FILE,CONST_ACTION_FUNC)
%>
<!-- #include file = "../template_a/page_admin_sys_info.html.asp" -->
<%
'== 页面析构
Call ActionOver()
%>
<%
'===================================================================
'= Function : LoadPageTpl()
'= Time : Created At 2006-5-4
'= Description : 加载页面模块
'===================================================================
Function LoadPageTpl()
%>
<%
End Function
'===================================================================
'= Function : DBCompCtl()
'= Time : Created At 2006-5-2
'= Input : None
'= Description : 压缩数据库
'===================================================================
Function DBCompCtl()
If Request("method") = "compress" Then
Dim fso, Engine, strDBPath,JET_3X,dbPath
dbPath = Server.MapPath(GBL_strHomeURL & GBL_strDBPath)
strDBPath = left(dbPath,instrrev(dbPath,"\"))
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(dbPath) Then
fso.CopyFile dbpath,strDBPath & "temp.mdb"
Set Engine = CreateObject("JRO.JetEngine")
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb"
fso.CopyFile strDBPath & "temp1.mdb",dbpath
fso.DeleteFile(strDBPath & "temp.mdb")
fso.DeleteFile(strDBPath & "temp1.mdb")
Set fso = nothing
Set Engine = nothing
Dim CompactDB
CompactDB = "你的数据库, " & dbpath & ", 已经压缩成功!" & vbCrLf
Else
CompactDB = "数据库名称或路径不正确. 请重试!" & vbCrLf
End If
Response.Write CompactDB
End If
Call DBComp()
End Function
'== 压缩数据库
Function DBComp()
%>
<div id="main_content">
<div id="main_content_title">
<div class="note">压缩数据库</div>
</div>
<div id="main_content_list">
<table border="0" cellspacing="1" class="main" cellpadding="5" height="1" align=center width="95%">
<tr class="even">
<td width="100%" height=23 colspan=4>
<B>压缩数据库</B>
</td>
</tr>
<form method="post" action="./admin_db_compress.asp?method=compress">
<tr class="even">
<td colspan=2 height=23>
在网站运行一段时间,数据库会变得膨胀而臃肿,从而影响网站性能,定期压缩数据库能保证网站的良好访问性能
</td>
</tr>
<tr class="even">
<td width="25%" height=23>
当前数据库路径:
</td>
<td >
<%=Server.Mappath(GBL_strDBPath)%>(<%=GetFileSize(GBL_strHomeURL & GBL_strDBPath)%>)
<input type="submit" value="开始压缩" onclick="return confirm('您确认要压缩数据库吗?')">
</td>
</td>
</tr>
</form>
</table>
</div>
<div id="main_content_foot"> </div>
</div>
<%
End Function
Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
Dim xTestObj
Set xTestObj = Server.CreateObject(strClassString)
If Err = 0 Then IsObjInstalled = True
If Err = -2147352567 Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function
Function GetFileSize(FileName)
Dim fso,drvpath,d,size,showsize
set fso=server.createobject("scripting.filesystemobject")
drvpath=server.mappath(FileName)
set d=fso.getfile(drvpath)
size=d.size
showsize=size & " Byte"
if size>1024 then
size=(Size/1024)
showsize=size & " KB"
end if
if size>1024 then
size=(size/1024)
showsize=formatnumber(size,2) & " MB"
end if
if size>1024 then
size=(size/1024)
showsize=formatnumber(size,2) & " GB"
end if
set fso=nothing
GetFileSize = showsize
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -