Re: CoInitialize has not been called?

Giganews Newsgroups
Subject: Re: CoInitialize has not been called?
Posted by:  Remy Lebeau (TeamB) (
Date: Thu, 10 Jun 2004

"Dan Bassett" <dbasse…> wrote in message

> 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).



In response to

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