介绍一个用ASP来压缩ACCESS数据库的例子

作者:袖梨 2022-06-30
<%    
    oldDB = "d: etaccessTest.mdb"
    bakDB = "d: etaccessTestBack.mdb"
    newDB = "d: etaccessCompact.mdb"

    Set FSO = Server.CreateObject("Scripting.FileSystemObject")

    ' back up database
    FSO.CopyFile oldDB, bakDB , true

    ' compact database
    Set Engine = Server.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) compacted database
    FSO.MoveFile newDB, oldDB

    set FSO = nothing    
%>

相关文章

精彩推荐