dim Engine,connpath,dbPath,strDBPath,fso
Set Engine = CreateObject("JRO.JetEngine")
connpath="#jobs.asp"‘与数据库在同一目录下,并没有临时文件temp.mdb
dbPath=server.MapPath(connpath)
strDBPath = left(DBPath,instrrev(DBPath,"\"))
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb"
Set Engine = nothing
dbPath=server.MapPath(connpath)
strDBPath = left(DBPath,instrrev(DBPath,"\"))
Set fso = CreateObject("Scripting.FileSystemObject")
on error resume next
fso.CopyFile strDBPath & "temp.mdb",dbpath
if err<>0 then coperr=true
fso.DeleteFile(strDBPath & "temp.mdb")
if err<>0 then delerr=true
Set fso = nothing
时间: 2024-10-11 00:52:52