Re: CoInitialize has not been called?

Giganews Newsgroups
Subject: Re: CoInitialize has not been called?
Posted by:  Remy Lebeau (TeamB) (gambit47.no.spam@no.spam.yahoo.com)
Date: Thu, 10 Jun 2004

"Dan Bassett" <dbasse…@bns.com.nospam> wrote in message
news:7D898B067FA0E240dbasse…@bns.com.nospam...

> I get this error when  I try to use an ADO component to write
> to a database inside the OnCommandGet event.  Is this not the
> way I should do it?  What's the correct way to do it then?

The error is very self-explanatory.  ADO is based on COM.  Every connected
client in Indy 9 runs in its own thread.  You did not call CoInitialize()
when a client connected in order to intialize the COM library for that
particular thread which you want to perform your ADO/COM operations in.
Call CoInitialize() in the OnConnect event, and then CoUninitialize() in the
OnDisconnect event (or at the top/bottom of OnCommandGet).

Gambit

Replies

In response to

CoInitialize has not been called? posted by Dan Bassett on Wed, 9 Jun 2004