Board index » delphi » Pack an Ms Access dbase with ADO

Pack an Ms Access dbase with ADO

Hi
How can I pack (remove deleted records ) from  access base with ADO controls
?

thanks

George

 

Re:Pack an Ms Access dbase with ADO


Quote
>How can I pack (remove deleted records ) from  access base with ADO controls

I have this code for compacting a mdb file.  You need to import the JRO type
library to use this

var
  MyJetEngine : JetEngine;
  strDataSource,strDataDest: string;
begin
  strDataSource :='DataSource=c:\data\Source.mdb;';
  strDataDest   := 'Data Source=c:\datascucompacted.mdb;' +
                   'Jet OLEDB:Engine Type=5';
                   {Use Engine Type 5 for Access 2000 db}
                   {Use Engine Type 4 for Access 97 db  }

  MyJetEngine := CoJetEngine.Create();
  try
    MyJetEngine.CompactDatabase(strDataSource, strDataDest);
  finally
    MyJetEngine := nil;
  end;
end;

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads