Board index » delphi » Compact Access databases using ADO

Compact Access databases using ADO

        How can I to compact and repair a .MDB MS Access database using ADO,
without use DAO 3.5?
        Please, reply with the code lines.

        Thank since now,
        Sena.

 

Re:Compact Access databases using ADO


Quote
>        How can I to compact and repair a .MDB MS Access database using ADO,
>without use DAO 3.5?
>        Please, reply with the code lines.

Compact is handled by JRO not ADO so if you want to go further first import the
JRO type library.  Then try this code

var
  MyJetEngine : JetEngine;
begin
  strDataSource := 'Data Source=c:\yourdir\yourdb.mdb;';
  strDataDest   := 'Data Source=c:\yourdir\your_compacted_db.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;
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Compact Access databases using ADO


"Jos Gon?alves de Sena" <j...@newview.com.br> wrote in message
news:8rqm8p$jbe2@bornews.borland.com...

Quote
>         How can I to compact and repair a .MDB MS Access database using
ADO,
> without use DAO 3.5?
>         Please, reply with the code lines.

http://codecentral.borland.com/codecentral/ccweb.exe/listing?id=15256

--

Quidquid latine dictum sit, altum viditur.

Other Threads