Article View: borland.public.cppbuilder.database.ado
Article #3763Re: TADOConnection in console application
From: Arnie Mauer
Date: Wed, 19 Jun 2002 13:42
Date: Wed, 19 Jun 2002 13:42
48 lines
2126 bytes
2126 bytes
See below.
- Arnie
"Louis van den Berg" <louisv@engineparts.co.za> wrote in message
news:3d105360_2@dnews...
> Hi,
>
> I use C++ Builder 5 Enterprise. I want to create a TADOConnection in a
> console application. My sample code is listed below:
>
> #include <vcl.h>
> #pragma hdrstop
> #include "ADOdb.hpp"
> #include <iostream.h>
> #include <conio.h>
> #pragma argsused
> int main(int argc, char* argv[])
> {
> try
> {
CoInitialize( 0 );
TADOConnection * ADOConnection = new TADOConnection( 0 );
> /** TADOConnection* ADOConnection(new TADOConnection(NULL)); **/
> delete ADOConnection;
> }
> catch (Exception& E)
> {
> cerr << E.Message.c_str();
> getch();
> }
>
> return 0;
> }
>
> The above code gives an error message saying: "CoInitialize has not been
> called". I suspect that the problem lies with the NULL that I pass to the
> constructor. The help file says that I should pass a window handle when
> creating the TADOConnection in a non-VCL window. I am not new to C++
Builder
> but I can't seem to be able to write the code to do what the help says.
Can
> someone please give me an example of what I need to do?
>
> Thanks
> Louis
>
>
Technical Details
Message-ID:
<3d108abd$1_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!news.tele.dk!small.news.tele.dk!128.230.129.106!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsReferences:
<3d105360_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,2e4eec1819bc6f81 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-06-19 06:45:46 PST From: "Arnie Mauer" <amauer@vrms.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3d105360_2@dnews> Subject: Re: TADOConnection in console application Date: Wed, 19 Jun 2002 09:42:29 -0400 Lines: 50 Organization: VRMS X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 209.140.211.97 Message-ID: <3d108abd$1_1@dnews> X-Trace: dnews 1024494269 209.140.211.97 (19 Jun 2002 06:44:29 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!news.tele.dk!small.news.tele.dk!128.230.129.106!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews