delphi access 数据库压缩  
官方Delphi 学习QQ群: 682628230(三千人)
频道

delphi access 数据库压缩


//uses ComObj; 
function compressDB(Afile:string):boolean; 
// 
var 
  DaoVar: OLEVariant; 
begin 
  try 
  DaoVar := CreateOleObject('dao.DBEngine.36'); 
  if FileExists('db.tmp') then deletefile('db.tmp'); 
//  DaoVar.CompactDatabase(afile,'db.tmp');    //压缩无密码的数据库 
  //压缩有密码的数据库。注意:密码不能为空 
  DaoVar.CompactDatabase(afile,'db.tmp',';pwd='+SDefDataBasePwd+'',0,';pwd='+SDefDataBasePwd+''); 
  if deletefile(afile) then RenameFile('db.tmp',Afile); 
  result:=true; 
  except 
    result:=False; 
  end; 
end; 


推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号

执行时间: 0.053724050521851 seconds