用Delphi压缩Access数据库
【打印文章】
uses dao97,dao2000;
procedure CompactMdbDatabase(srcDbname,dstDbname,oldpwd,newpwd:string;bAccess97: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;
procedure CompactMdbDatabase(srcDbname,dstDbname,oldpwd,newpwd:string;bAccess97: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;
本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。( Pfan.cn )
【编程爱好者论坛】