ASP压缩数据库
类别: ASP教程
<%
option explicit
Const JET_3X = 4
Function CompactDB(dbPath, boolIs97)
Dim fso, Engine, strDBPath
strDBPath = server.mappath("./")
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
CompactDB = " 您的数据库:" & dbpath & "已经被成功压缩" & vbCrLf
Else
CompactDB = "找不到该文件,请检查路径是否正确" & vbCrLf
End If
End Function
%>
<html><head><title>压缩数据库</title></head><body>
<h2 align="center"><b><font size="3" color="#0066CC">压缩数据库</font></b></h2>
<p align="center">
<form action=index.asp>
<font size="2">请输入您的数据库文件地址(如data/mdb.mdb)</font><br>
<br>
<input type="text" name="dbpath"><br><br>
<input type="checkbox" name="boolIs97" value="True">
<font size="2"> 检查是否是ACCESS97(默认是2000)</font><br>
<br>
<input type="submit">
</form><form>
<br><br></form>
<%
Dim dbpath,boolIs97
dbpath = request("dbpath")
boolIs97 = request("boolIs97")
If dbpath <> "" Then
dbpath = server.mappath(dbpath)
response.write(CompactDB(dbpath,boolIs97))
End If
%>
option explicit
Const JET_3X = 4
Function CompactDB(dbPath, boolIs97)
Dim fso, Engine, strDBPath
strDBPath = server.mappath("./")
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
CompactDB = " 您的数据库:" & dbpath & "已经被成功压缩" & vbCrLf
Else
CompactDB = "找不到该文件,请检查路径是否正确" & vbCrLf
End If
End Function
%>
<html><head><title>压缩数据库</title></head><body>
<h2 align="center"><b><font size="3" color="#0066CC">压缩数据库</font></b></h2>
<p align="center">
<form action=index.asp>
<font size="2">请输入您的数据库文件地址(如data/mdb.mdb)</font><br>
<br>
<input type="text" name="dbpath"><br><br>
<input type="checkbox" name="boolIs97" value="True">
<font size="2"> 检查是否是ACCESS97(默认是2000)</font><br>
<br>
<input type="submit">
</form><form>
<br><br></form>
<%
Dim dbpath,boolIs97
dbpath = request("dbpath")
boolIs97 = request("boolIs97")
If dbpath <> "" Then
dbpath = server.mappath(dbpath)
response.write(CompactDB(dbpath,boolIs97))
End If
%>
- 上一篇: 正则表达式结合数组提取文章中的文件名
- 下一篇: ASP字符串函数大全
-= 资 源 教 程 =-
文 章 搜 索