|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
大家可以自己去看一看.可以说看得想呕吐.以前有次下了个动网来看.里面连基本内置函数的保护措施(函数没防御性)都没有.难怪经常补这个补那个了.可能现在.NET版会好点吧access|数据|数据库|紧缩|在线 While working on BuildDB/Buildapp online Demo, I developed a little function that will compact Access databases over the web. Here's a "no-frills" page that'll compact the databases for you.
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.
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..
++++++++++++ Begin Compact.asp +++++++++++++++++++++++++++++
<%
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.asp>
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")
If dbpath <> "" Then
dbpath = server.mappath(dbpath)
response.write(CompactDB(dbpath,boolIs97))
End If
%>
</p></body></html>
++++++++++++ End Code
</p> 缺乏可以共同遵循的行业标准,ASP还处在发展初期,大家对它的理解不同,如产品和服务标准,收费标准等,不利于行业的健康发展。 |
|