Article View: borland.public.cppbuilder.database.ado
Article #3761TADOConnection in console application
From: Louis van den Berg
Date: Wed, 19 Jun 2002 09:49
Date: Wed, 19 Jun 2002 09:49
36 lines
1927 bytes
1927 bytes
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
{
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:
<3d105360_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!news.tele.dk!small.news.tele.dk!194.213.69.151!news.algonet.se!algonet!skynet.be!skynet.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,2e4eec1819bc6f81,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-06-19 02:53:14 PST Reply-To: "Louis van den Berg" <louisv@engineparts.co.za> From: "Louis van den Berg" <louisv@engineparts.co.za> Newsgroups: borland.public.cppbuilder.database.ado Subject: TADOConnection in console application Date: Wed, 19 Jun 2002 11:49:50 +0200 Lines: 38 Organization: Engineparts (Pty) Ltd 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: 196.15.212.3 Message-ID: <3d105360_2@dnews> X-Trace: dnews 1024480096 196.15.212.3 (19 Jun 2002 02:48:16 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!news.tele.dk!small.news.tele.dk!194.213.69.151!news.algonet.se!algonet!skynet.be!skynet.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews