🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: how to using dao

#975
From: Viatcheslav V. Vassiliev
Date: Mon, 21 Feb 2005 14:51
51 lines
2561 bytes
When compacting Access db it must be disconnected. Compact always into
another file. Later you may delete initial file and copy new file into its
place.

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.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)


"yag" <yagyog@tiscali.it> �������/�������� � �������� ���������: 
news:4219ac0f@newsgroups.borland.com...
> help me.!I did not know where to post
> How to compact database mdm (access) witch ado or dao from code ...
>
>
>
>
>
> ~-----------------------------------------------------~
> ...c++, oo, designs are my passion...
> 
Technical Details
Message-ID: <4219f580@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4219ac0f@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,8e72e66a1c539ac3,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <4219ac0f@newsgroups.borland.com>
Subject: Re: how to using dao 
Date: Mon, 21 Feb 2005 17:51:42 +0300
Lines: 53
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 85.93.136.152
Message-ID: <4219f580@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1108997504 85.93.136.152 (21 Feb 2005 06:51:44 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail