Board index » delphi » How to compact Access database with ADO

How to compact Access database with ADO

How can I compact an access database using ADO?
What should I need to deploy along with my application to utilize an Access
database accessed through ADO, MDAC and JET will be enough?
 

Re:How to compact Access database with ADO


1. Import type library MS JRO (Replication ..)
2. use ... JRO_TLB ...

  const
    PROVIDER = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=';
  With TSaveDialog.Create(nil) do
  begin
    FileName :='';
    Filter:= 'Microsoft Access files|*.mdb;All Files|*.*';
    DefaultExt := 'mdb';
    Title := 'Saving Database as...';
    If Execute then
    begin
      if not (OldMDB = FileName) then
      begin
        JE:= CoJetEngine.Create;   //from type library
        JE.CompactDatabase(PROVIDER + OldMDN, PROVIDER + FileName);
        except
          on E:Exception do ShowMessage(E.Message);
        end;
      end//if filename not equal.
      else
        MessageDlg('Cannot save as same filename!', mtWarning, [mbOK,
mbCancel], 0);
    end;
    Free;
  end;

Note: before compact, OldMDB must not be opened.
Deploy?... nothing, for Win98++.  Install MDAC 2.6 ++ for Win95.

HTH.

Hott

Quote
"Fabrizio Bocci" <fabri...@rtv38.com> wrote in message

news:3cce5121$1_2@dnews...
Quote
> How can I compact an access database using ADO?
> What should I need to deploy along with my application to utilize an
Access
> database accessed through ADO, MDAC and JET will be enough?

Re:How to compact Access database with ADO


...
Var
  JE: IJetEngine; //Interfase
begin...

Sorry... you might crack your head...what the hell is JE

Cheers

Hott

Other Threads