ASPONE.CN
苦逼

ASP压缩ACCESS数据库

<%
oldDB = "d:netaccessTest.mdb"
bakDB = "d:netaccessTestBack.mdb"
newDB = "d:netaccessCompact.mdb"
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
'首先备份数据库
FSO.CopyFile oldDB, bakDB , true
'对原数据库进行压缩,生成压缩后的新数据库
Set Engine = Server.CreateObject("JRO.JetEngine")
prov = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
Engine.CompactDatabase prov & OldDB, prov & newDB
set Engine = nothing
'删除原数据库
FSO.DeleteFile oldDB
'把压缩后的新数据库重命名为原来的数据库
FSO.MoveFile newDB, oldDB
set FSO = nothing
%>

Copyright © 2016 ASPONE.CN. All Rights Reserved. 京ICP备18038662号