🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: compacting mdb

#2908
From: Viatcheslav V. Vassiliev
Date: Fri, 28 Feb 2003 06:36
84 lines
3798 bytes
CompactDatabase returns COM error code. 0 is S_OK - look winerror.h for more
codes, use OleCheck(errorCode) to throw exception in case error code
indicates error. JetEngine->Release() is the same as IUnknown->Release() -
look any help for COM for details.

You can find help on CoCreateInstance, IUnknown and other COM specifics in
MSDN.

----------------------------------------------------------------
Regards,
Viatcheslav V. Vassiliev
http://www.oledbdirect.com
The fastest way to access MS SQL Server, MS Jet (MS Access)
and Interbase (through OLEDB) databases.

"Joe Greenthal" <joegreenthal@cox.net> ???????/???????? ? ????????
?????????: news:3E5EE173.3040207@cox.net...
> 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: <3e5f0384@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3e43c5f7@newsgroups.borland.com> <3e44be76@newsgroups.borland.com> <3E5EE173.3040207@cox.net>

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 22:38:52 PST
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3e43c5f7@newsgroups.borland.com> <3e44be76@newsgroups.borland.com> <3E5EE173.3040207@cox.net>
Subject: Re: compacting mdb
Date: Fri, 28 Feb 2003 09:36:28 +0300
Lines: 87
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 213.247.201.57
Message-ID: <3e5f0384@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1046414212 213.247.201.57 (27 Feb 2003 22:36:52 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail