在线压缩Access数据库
One problem with Access databases is that "holes" are created when records are deleted, making the database fluffy and bloated. Compacting the database makes it lean and efficient again. 内容来自dedecms
Note: This function/page can easily be combined with the Buildapp front end file navigation and search pages (Installment II), to create an application that'll make it easy to handle this formerly troublesome chore for all the databases on your machine/web site..
内容来自dedecms
Begin Compact.
<%
option explicit
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
CompactDB = "Your database, " & dbpath & ", has been Compacted" & vbCrLf
Else
CompactDB = "The database name or path has not been found. Try Again" & vbCrLf
End If
本文来自织梦
End Function
%>
<html><head><title>Compact Database</title></head><body>
<h2 align="center"> Compacting an Access database</h2>
<p align="center">
<form action=compact.>
Enter relative path to the database, including database name.<br><br>
<input type="text" name="dbpath"><br><br>
<input type="checkbox" name="boolIs97" value="True"> Check if Access 97 database
<br><i> (default is Access 2000)</i><br><br>
<input type="submit">
<form>
<br><br>
<%
Dim dbpath,boolIs97
dbpath = request("dbpath")
boolIs97 = request("boolIs97") dedecms.com
If dbpath <> "" Then
dbpath = server.mappath(dbpath)
response.write(CompactDB(dbpath,boolIs97))
End If
%>
</p></body></html>
dedecms.com
End Code
压缩
文章评论
共有位Admini5网友发表了评论 查看完整内容