Article View: borland.public.cppbuilder.database.ado
Article #2903Re: compacting mdb
From: Joe Greenthal
Date: Fri, 28 Feb 2003 04:11
Date: Fri, 28 Feb 2003 04:11
66 lines
3042 bytes
3042 bytes
Vassiliev:
I've been hunting for weeks on the Internet for a Borland example
of compacting an MSACCESS database. The information that I found
referred to MS VC++ or Delphi, none of these examples clued me in on
using the "CoCreateInstance(...)" method. Thank you for your example
that I found on Borland's ADO User's Group.
Do you have a list of error codes returned be "CompactDatabase(..)"
or "JetEngine->Release()" ?? I've determined that "0" is returned
by "CompactDatabase(..)" when the database has been compacted
successfully.
thanks,
Joe G.
Vassiliev V.V. wrote:
> Import type library:
> Microsoft Jet and Replication Objects 2.x Library
>
> #include <JRO_TLB.h>
> ...
> void __fastcall TForm1::Button1Click(TObject *Sender)
> {
> IJetEngine * JetEngine = NULL;
> CoCreateInstance(CLSID_JetEngine, NULL, CLSCTX_INPROC_SERVER,
> IID_IJetEngine,
> (void**) &JetEngine);
>
> WideString Source = "Provider=Microsoft.Jet.OLEDB.4.0;"
> "Data Source=C:\\Test\\Test.mdb;";
> WideString Dest = "Provider=Microsoft.Jet.OLEDB.4.0;"
> "Data Source=C:\\Test\\Compacted.mdb;";
>
> JetEngine->CompactDatabase(Source.c_bstr(), Dest.c_bstr());
>
> JetEngine->Release();
> }
>
>
> You can compact database from one file into another. There should be no
> users connected to database.
>
> ----------------------------------------------------------------
> Regards,
> Viatcheslav V. Vassiliev
> http://www.oledbdirect.com
> The fastest way to access MS SQL Server, MS Jet (MS Access)
> and Interbase (LCPI provider, http://ibp.lcpi.lipetsk.ru) databases.
>
> "Gabriel Martinez" <gabotz@fibertel.com.ar> �������/�������� � ��������
> ���������: news:3e43c5f7@newsgroups.borland.com...
>
>>is there a way to compact an access database from c++ builder. some code
>
> may
>
>>help, thanks
>>
>>
>
>
>
Technical Details
Message-ID:
<3E5EE173.3040207@cox.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3e43c5f7@newsgroups.borland.com> <3e44be76@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,e8d7ebe14cab55db X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-02-27 20:09:24 PST Message-ID: <3E5EE173.3040207@cox.net> Date: Thu, 27 Feb 2003 21:11:31 -0700 From: Joe Greenthal <joegreenthal@cox.net> User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: compacting mdb References: <3e43c5f7@newsgroups.borland.com> <3e44be76@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 68.3.61.194 X-Trace: newsgroups.borland.com 1046405216 68.3.61.194 (27 Feb 2003 20:06:56 -0800) Lines: 67 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail