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

📄 compact.asp

📁 公文下发和上报管理:   在发布和上报文件时
💻 ASP
字号:
<%
option explicit

if instr(Request.ServerVariables("http_referer"),""&Request.ServerVariables("server_name")&"") = 0 then
response.write "<script>alert('来源错误!');history.back();</script>"
response.end
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")
		'是acess97
		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.asp"
		End If
		fso.CopyFile strDBPath & "temp.asp",dbpath
		fso.DeleteFile(strDBPath & "temp.asp")
		Set fso = nothing
		Set Engine = nothing
		CompactDB = "<script>alert('压缩成功!');history.back();</script>"
	Else
		CompactDB = "<script>alert('找不到数据库!\n请检查数据库路径是否输入错误!');history.back();</script>"
	End If
End Function

Dim dbpath,boolIs97
dbpath = request("dbpath")
boolIs97 = request("boolIs97")

If dbpath <> "" Then
	dbpath = server.mappath(dbpath)
	response.write(CompactDB(dbpath,boolIs97))
End If
%>

⌨️ 快捷键说明

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