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; 

相关阅读 >>

Delphi date 返回当前的日期

Delphi如何删除数据库重复记录(4种方法)

Delphi firedac 下的 sqlite [6] - 加密

shellexecute的多种用法

为什么编程是独一无二的职业

Delphi的获取某坐标的颜色值

Delphi读写文本文件

Delphi edit控制字居中,居左,居右

Delphi中如何用一个按钮控制开与关两个状态

Delphi建立文件的快捷方式

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...