🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TADOConnection in console application

#3766
From: Vassiliev V.V.
Date: Thu, 20 Jun 2002 06:14
60 lines
2605 bytes
It is a good idea to call CoUninitialize() at end. You should call
CoInitialize() / CoUninitialize() in every thread.

Regards,
Vassiliev V.V.
http://www.oledbdirect.com

"Arnie Mauer" <amauer@vrms.com> �������/�������� � �������� ���������:
news:3d108abd$1_1@dnews...
> 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: <3d118977$1_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!yellow.newsread.com!netaxs.com!newsread.com!netnews.com!news.maxwell.syr.edu!nnxp1.twtelecom.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews
References: <3d105360_2@dnews> <3d108abd$1_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,2e4eec1819bc6f81
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-06-20 01:00:26 PST
From: "Vassiliev V.V." <news@vassilievvv.mtu-net.ru>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3d105360_2@dnews> <3d108abd$1_1@dnews>
Subject: Re: TADOConnection in console application
Date: Thu, 20 Jun 2002 10:14:33 +0400
Lines: 62
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: 62.118.132.1
Message-ID: <3d118977$1_2@dnews>
X-Trace: dnews 1024559479 62.118.132.1 (20 Jun 2002 00:51:19 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!yellow.newsread.com!netaxs.com!newsread.com!netnews.com!news.maxwell.syr.edu!nnxp1.twtelecom.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews