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,dao2000procedure 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
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)