⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reduce.asp

📁 一个不错的个人商务网站的源码
💻 ASP
字号:
<!--#include file="chk.asp"-->
<html><head><title>数据压缩</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href=AdminStyle.css rel=stylesheet type=text/css>
</head>
<body>
<div align="center">
<table border="0" width="100%" id="table1" cellspacing="1" style="border:1px solid #183789; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px" bordercolor="#CCCCCC" cellpadding="4">
	<tr>
		<td background="Image/admin_bg_1.gif" height="25"><b>
		<font color="#FFFFFF">数据压缩</font></b></td>
	</tr>
	<tr>
		<td><form action=reduce.asp>
<b>注意:</b>( 需要FSO支持,FSO相关帮助请看微软网站 ) <br>输入数据库所在相对路径,并且输入<font color="red">正确</font>的数据库名称和密码,名称和密码同时正确数据库才会被压缩成功。(<font color="red">正在使用中数据库不能压缩,请选择备份数据库进行压缩操作</font>)

<BR>压缩数据库:<input type="text" name="dbpath" value="../backupdata/byec_shop.mdb" size="34">
<BR>数据库密码:<input type="text" name="password" size="34">      
<BR><input type="submit" value="开始压缩">

</form></td>
	</tr>
</table>

</div>

<%
Dim dbpath,password
dbpath = request("dbpath")
password = request("password")

If dbpath <> "" Then
Const JET_3X = 4

dbpath = server.mappath(dbpath)
	response.write(CompactDB(dbpath))
End If


Function CompactDB(dbPath)
Dim fso, Engine, strDBPath
strDBPath = left(dbPath,instrrev(DBPath,"\"))
strDBPath = strDBPath & "temp.asp"
Set fso = CreateObject("Scripting.FileSystemObject")


If fso.FileExists(dbPath) Then
Set Engine = CreateObject("JRO.JetEngine")
On Error Resume Next

		Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password='" & password & "';Data Source=" & dbpath, _
		"Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password='" & password & "';Data Source=" & strDBPath
	

fso.CopyFile strDBPath ,dbpath
fso.DeleteFile(strDBPath)
Set fso = nothing
Set Engine = nothing

	CompactDB = "操作完成。<br>如果密码正确你的数据库, " & dbpath & ", 将会被压缩!" & vbCrLf

Else
	CompactDB = "数据库名称或路径不正确. 请重试!" & vbCrLf
End If

End Function
%>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -