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

80酷酷网    80kuku.com

  access|数据|数据库|压缩<%  
    oldDB = "d:\net\accessTest.mdb"
    bakDB = "d:\net\accessTestBack.mdb"
    newDB = "d:\net\accessCompact.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  
%>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: