//给你贴一段代码
var
sSource, sTerminal: String;
begin
if SaveDialog1.Execute then
begin
try
Screen.Cursor := crHourGlass;
//要压缩的数据库
sSource := AppPath+'DataBase/LandBase.Mdb';
sTerminal := SaveDialog1.FileName;
if FileExists(sTerminal) then
DeleteFile(sTerminal);
if Dm.CompactAndRepair(sSource,SaveDialog1.FileName) then
//自己写的过程
InfoMsg('压缩备份数据成功!')
else
//自己写的过程
ErrorMsg('压缩备份数据失败,请检查是否有足够的磁盘空间、目标文件是否已经打开!')
finally
Screen.Cursor := crDefault;
end;
end;
end;