📄 backup3.asp
字号:
<%
if session("yida_username")="" then
%>
<script language="javascript">
top.location.href="../index.asp"
</script>
<%
response.end
end if
%>
<html>
<head>
<title><%=dianming%> - 数据库压缩</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<style>
body {
background-color:#FFFFFF;
}
</style>
</HEAD>
<BODY>
<%if request("hid1")="" then%>
<form name="form1" method="post">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td> 压缩数据库</td>
<td align="right"> </td>
</tr>
</table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
<tr>
<td height="30" colspan="2" align="center" class="category">你的空间只有支持fso才可以进行如下操作,否则你只能手动压缩</td>
</tr>
<tr>
<td width="25%" height="30" align="right">当前数据库路径:</td>
<td width="75%" class="category">
<input type="text" name="mdbpath" size="30" value="backup/#yida_jxc31#.dat" readonly="true">
<input type="radio" value="false" checked name="ys"> 使用 Access 2000 数据库
</td>
</tr>
<tr>
<td height="30" align="right"> </td>
<td class="category">
(为了安全,请注意用备份的数据库文件来压缩,不要用当前正在运行的数据库文件)
</td>
</tr>
<tr class="a3">
<td align="center" colspan="2" class="category">
<input type="submit" value=" 确认压缩 " class="button">
<input type="hidden" name="hid1" value="ok"></td>
</tr>
</table>
</td>
<td></td>
</tr>
<tr>
<td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr>
</table>
</form>
<%
else
'-----------------------------------------
Dim dbpath,boolIs97
dbpath="../"&request.form("mdbpath")
boolIs97=request.form("ys")
If dbpath <> "" Then
dbpath = server.mappath(dbpath)
response.write(CompactDB(dbpath,boolIs97))
End If
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
response.write"<script>alert('您的数据库已经压缩成功!');history.go(-1)</script>"
response.End()
Else
response.write"<script>alert('数据库名称或路径不正确. 请重试!');history.go(-1)</script>"
response.End()
End If
End Function
'--------------------------------------------
end if
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -