How to repair Access Database from Delphi

From: Pascal Schmidt-Volkmar (nospam_at_schmidt-volkmar.com)
Date: 03/30/04


Date: Tue, 30 Mar 2004 17:44:50 +0200

Hi there,

till now I am using this code to compress my access database. But I also
would like to repair it, but how??

procedure TfMain.CompactDBExecute;
var
 engine: IJetEngine;
 src, dst, path: WideString;
begin
 path := ExtractFilePath(ParamStr(0));
 src := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+sDatenbank+';Jet
OLEDB:Database Password=';

 if fileexists('c:\compressed.mdb') then DeleteFile('c:\compressed.mdb');
 dst := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\compressed.mdb;Jet
OLEDB:Database Password=';

 engine := CoJetEngine.Create();
 engine.CompactDatabase(src, dst);
 DeleteFile(sDatenbank);
 RenameFile('c:\compressed.mdb',sDatenbank);
end;

Greetz,

Pascal



Relevant Pages

  • Re: Realtime clock that understands DST
    ... It basically gets the GMT offset in january and the GMT offset in ... expanded upon it in order to determine when DST starts and when it ... var rightNow = new Date; ... Daylight Savings Time Starts At = <span ...
    (comp.lang.javascript)
  • Determine start and end of DST by locale - client side
    ... came across some code which determines if the user's locale observes ... daylight savings time (DST) according to the user's locale specified ... var rightNow = new Date; ... locale does not observe Daylight Savings Time'; ...
    (comp.lang.javascript)
  • Re: Cannot attach to Services Manager
    ... > engine.CompactDatabase(src, dst); ... I ran the above code with a database sitting inside of the folder, ... //src is connection string to existing database ...
    (borland.public.delphi.database.ado)
  • Re: Cannot attach to Services Manager
    ... > engine.CompactDatabase(src, dst); ... I ran the above code with a database sitting inside of the folder, ... //src is connection string to existing database ...
    (borland.public.delphi.database.ado)
  • Re: time zone
    ... //Form date/time validation ... dst starts on the first sunday in april and ends on ... var num_msecs = gdate.getTime; ...
    (comp.lang.javascript)