I was thinking of adding a compact and repair function to my database control panel. Are there any problems with using this? Will the locking feature of an access database cause any problems? Any comments are appreciated.
Here is the script
Dodge20
Here is the script
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
oldDB = Server.MapPath("../db/database.mdb")
bakDB = Server.MapPath("../db/databaseBack.mdb")
newDB = Server.MapPath("../db/database.mdb")
Set FSO = CreateObject("Scripting.FileSystemObject")
' back up database
FSO.CopyFile oldDB, bakDB, true
' compact database
Set Engine = CreateObject("JRO.JetEngine")
prov = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
Engine.CompactDatabase prov & OldDB, prov & newDB
set Engine = nothing
' delete original database
FSO.DeleteFile oldDB
' move / rename our new, improved, compacted database
FSO.MoveFile newDB, oldDB
set FSO = nothing
%>
Dodge20