Plurk
使用Delphi 壓縮 Access DB
網路上找來的, 原來還蠻簡單, 以前一直沒去想, 突然用上, 找來頂一下!function compressDB(dbName: string): Boolean;
var DaoVar: OLEVariant;
begin
if ADOConn.Connected then ADOConn.Close;
try
try
DaoVar := CreateOleObject('DAO.DBEngine.36');
if FileExists('temp.mdb') then DeleteFile('temp.mdb');
DaoVar.CompactDatabase(dbName, 'temp.mdb');
if DeleteFile(dbName) then RenameFile('temp.mdb', dbName);
ShowMessage('Success');
Result := true;
except
Result := false;
end;
finally
ADOConn.Open;
end;
end;
訂閱:
張貼留言 (Atom)
0 意見:
張貼留言