🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #4152

Re: Compacting MsAccess database

#4152
From: Vassiliev V.V.
Date: Thu, 28 Mar 2002 15:48
39 lines
2036 bytes
1. Import Microsoft Jet and Replication Objects 2.x Library.

2.

#include "JRO_TLB.h"
void CompactAccessDB(AnsiString dbFile, AnsiString resFile)
{
 IJetEngine * JetEngine = NULL;
 ::CoCreateInstance(CLSID_JetEngine, NULL, CLSCTX_ALL, IID_IJetEngine,
  (void**)&JetEngine);
 if (!JetEngine) throw Exception("Jet Engine is not initialized");

 WideString dbConnStr("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
dbFile + ";");
 WideString resConnStr("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
resFile + ";");
 JetEngine->CompactDatabase(dbConnStr.c_bstr(), resConnStr.c_bstr());
 JetEngine->Release();
}

Jet (Access) databases are compacted into new file. No users should be
connected to database when compacting.

Regards,
Vassiliev V.V.
http://www.oledbdirect.com

"Pawe�Urbaniak" <pawel_u@wapro.com.pl> �������/�������� � ��������
���������: news:3ca31550_2@dnews...
> Hello.
>
> Does anybody know how to compact MsAccess database using ADO or ADOExpress
?
>
> --
> Best Regards
> Pawe� Urbaniak
>
>
Technical Details
Message-ID: <3ca33bee_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!newsfeed.gamma.ru!Gamma.RU!newsfeed.media.kyoto-u.ac.jp!out.nntp.be!propagator-SanJose!in.nntp.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3ca31550_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,a472846125b25697
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-03-28 07:59:41 PST
From: "Vassiliev V.V." <vv_vas@iname.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3ca31550_2@dnews>
Subject: Re: Compacting MsAccess database
Date: Thu, 28 Mar 2002 18:48:51 +0300
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 62.118.136.122
Message-ID: <3ca33bee_2@dnews>
X-Trace: dnews 1017330670 62.118.136.122 (28 Mar 2002 07:51:10 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!newsfeed.gamma.ru!Gamma.RU!newsfeed.media.kyoto-u.ac.jp!out.nntp.be!propagator-SanJose!in.nntp.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews