Article View: borland.public.cppbuilder.database.ado
Article #2571Re: Compacting a DB from the Builder
From: Viatcheslav V. Vassiliev
Date: Wed, 28 May 2003 13:06
Date: Wed, 28 May 2003 13:06
47 lines
2405 bytes
2405 bytes
Import "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);
try
{
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());
}
__finally
{
JetEngine->Release();
}
}
You can compact database from one file into another. There should be no
users connected to database. Add error checking to this code.
----------------------------------------------------------------
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.
"P�r Buschka" <par.buschka@tech.oru.se> �������/�������� � ��������
���������: news:3ed4afee$1@newsgroups.borland.com...
> Hi,
>
> I want to compact an Access2000 database programmatically from within a
> program, using CppBuilder 6. I wonder if this is possible and in that case
> how to do it?
>
> Thanks in advance
> P�r
>
>
Technical Details
Message-ID:
<3ed4b463@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3ed4afee$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,dbc094b16675290e X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-05-28 06:12:10 PST From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3ed4afee$1@newsgroups.borland.com> Subject: Re: Compacting a DB from the Builder Date: Wed, 28 May 2003 17:06:40 +0400 Lines: 49 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: <3ed4b463@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1054127203 213.247.201.57 (28 May 2003 06:06:43 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!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