Article View: borland.public.cppbuilder.database.ado
Article #795Re: Creeating MS Access database dynamically
From: Viatcheslav V. Vassiliev
Date: Wed, 27 Apr 2005 20:43
Date: Wed, 27 Apr 2005 20:43
47 lines
2555 bytes
2555 bytes
Import ADOX type library and execute
//strConn is connection string.
Adox_tlb::TCOM_Catalog cat = CoCatalog::Create();
cat->Create(strConn.c_bstr());
or
CatalogPtr cat = CoCatalog::Create();
cat->Create(strConn);
You may also need to add (for C++ Builder 6)
#include <comobj.hpp>
namespace System
{
void __fastcall CheckSafecallResult(HRESULT hr)
{
OleCheck(hr);
}
}
All strings should be declared as WideString, not as AnsiString.
//------------------------------------------
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)
"Eric Archer" <eric.archer@noaa.gov> �������/�������� � �������� ���������:
news:426fba1d$1@newsgroups.borland.com...
>
> I'm using BCB 6 and am fairly new at working with databases. I've been
> successful at interacting with my MS Access database using ADO, but I've
> got an issue that I haven't found any way to solve:
>
> If someone "accidentally" deletes the database file, I'd like the
> application to check for its existence (if (!FileExists("data.mdb")), and
> to create a new database file, regenerate the fields, and populate it with
> a minimum of data hardcoded in the application. Is this possible with ADO
> and MS Access? Thanks!
Technical Details
Message-ID:
<426ff965$1@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.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<426fba1d$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,e15b10e8565000ef X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <426fba1d$1@newsgroups.borland.com> Subject: Re: Creeating MS Access database dynamically Date: Thu, 28 Apr 2005 00:43:17 +0400 Lines: 49 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; Original NNTP-Posting-Host: 85.93.138.132 Message-ID: <426ff965$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1114634597 85.93.138.132 (27 Apr 2005 13:43:17 -0700) 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.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail