Article View: borland.public.cppbuilder.nativeapi
Article #7173Re: Compact and Repair MS Access2000
From: Kane
Date: Wed, 09 Mar 2005 18:37
Date: Wed, 09 Mar 2005 18:37
62 lines
2374 bytes
2374 bytes
Thanks for the solution,
But how can compact the database without creating the copied one (Compacted.mdb)?
can it done by just changing the name of Compacted.mdb to test.mdb?
>Why it crashes? It's not the normal behavior...
Sometimes my databases crashed which leads that my app does not work properly (with the items related to de db).
"Vladimir Stefanovic" <antivari@po.sbb.co.yu> wrote:
>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:
<422f426f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.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-mailReferences:
<422f341e$1@newsgroups.borland.com> <422f3a2e@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: "Kane" <Kane_34@yahoo.com> Sender: "Kane" <Kane_34@yahoo.com> Reply-To: "Kane" <Kane_34@yahoo.com> Subject: Re: Compact and Repair MS Access2000 Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 62.177.189.75 References: <422f341e$1@newsgroups.borland.com> <422f3a2e@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <422f426f$1@newsgroups.borland.com> Date: 9 Mar 2005 10:37:35 -0800 X-Trace: newsgroups.borland.com 1110393455 207.105.83.66 (9 Mar 2005 10:37:35 -0800) Lines: 63 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.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