Article View: borland.public.cppbuilder.nativeapi
Article #7174Re: Compact and Repair MS Access2000
From: Vladimir Stefanovic
Date: Wed, 09 Mar 2005 18:02
Date: Wed, 09 Mar 2005 18:02
45 lines
1934 bytes
1934 bytes
This is not an API question. It's a question for ADO
group, and it has been answered many times:
<quote>
When compacting Access db it must be disconnected.
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();
}
}
Compact will also repair database.
</quote>
> I am having a trouble with a MS Access2000 database.
> I have to compact and repair it everytime my app crashes.
Why it crashes? It's not the normal behavior...
--
Best regards,
Vladimir Stefanovic
Technical Details
Message-ID:
<422f3a2e@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<422f341e$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c8f596f591faac7f X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Vladimir Stefanovic" <antivari@po.sbb.co.yu> Newsgroups: borland.public.cppbuilder.nativeapi References: <422f341e$1@newsgroups.borland.com> Subject: Re: Compact and Repair MS Access2000 Date: Wed, 9 Mar 2005 19:02:21 +0100 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 82.117.212.65 Message-ID: <422f3a2e@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1110391342 82.117.212.65 (9 Mar 2005 10:02:22 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail