如何用Delphi压缩Access数据库

如何用Delphi压缩Access数据库,第1张

uses dao97,dao2000

procedure CompactMdbDatabase(srcDbname,dstDbname,oldpwd,newpwd:stringbAccess97:boolean=true)

var idbEngine:_dbEngine

begin

if oldpwd <>'' then oldpwd := 'pwd='+oldpwd

if newpwd <>'' then newpwd := 'pwd='+newpwd

if bAccess97 then

begin

idbengine := CreateComObject(dao97.CLASS_DBEngine) as _DBEngine

idbEngine.CompactDatabase(srcDbname,dstDbname,newpwd,dbVersion30,oldpwd)

end else

begin

idbengine := CreateComObject(dao2000.CLASS_DBEngine) as _DBEngine

idbEngine.CompactDatabase(srcDbname,dstDbname,newpwd,dbVersion40,oldpwd)

end

end

uses dao97,dao2000

procedure CompactMdbDatabase(srcDbname,dstDbname,oldpwd,newpwd:stringbAccess97:boolean=true)

var idbEngine:_dbEngine

begin

if oldpwd <>'' then oldpwd := 'pwd='+oldpwd

if newpwd <>'' then newpwd := 'pwd='+newpwd

if bAccess97 then

begin

idbengine := CreateComObject(dao97.CLASS_DBEngine) as _DBEngine

idbEngine.CompactDatabase(srcDbname,dstDbname,newpwd,dbVersion30,oldpwd)

end else

begin

idbengine := CreateComObject(dao2000.CLASS_DBEngine) as _DBEngine

idbEngine.CompactDatabase(srcDbname,dstDbname,newpwd,dbVersion40,oldpwd)

end

end

也可以参考一下文章:

利用Delphi压缩和修复MS Access 2000的数据库文件

http://www.delphibbs.com/keylife/iblog_show.asp?xid=4904

动态创建与压缩Access数据库

http://www.delphifans.com/infoview/Article_334.html


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/10035250.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-04
下一篇 2023-05-04

发表评论

登录后才能评论

评论列表(0条)

保存