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

发表于:2007-06-30来源:作者:点击数: 标签:
% 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 Engi
<%  
    oldDB = "d:.net\aclearcase/" target="_blank" >ccessTest.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  
%>

原文转自:http://www.ltesting.net