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列表控件tlistview定位到某一行

Delphi comparedatetime、comparedate、comparetime、samedatetime、samedate、sametime �c 对比时间的函数

Delphi 实现英汉字典的转换

Delphi编写涂鸦桌面的小程序

Delphi api读写ini文件

Delphi 10.2 创建并使用资源文件

Delphi winapi: gettickcount - 获取系统已启动的时间

Delphi 通过api 隐藏任务栏所有托盘图标

Delphi richedit根据鼠标位置定位光标的方法

indy 中idhttp元件出现http status 302错误

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



打赏

取消

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

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

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

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

评论

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