Page 1 of 1

SDAC in Console apptype

Posted: Mon 02 Jan 2006 21:24
by chris
Hi to all,

I'm trying to use the SDAC Components in a console app. I've created the MSConnection. Calling the connect method I get following error:

OLE DB Error occured. Code 800401F0h.
Coinitialize has not been called.

Can anybody help me? What I have to do?

Best regards
Chris

Posted: Tue 03 Jan 2006 07:50
by Ikar
As SDAC uses OLE DB before a new connection it is necessary to initialize OLE - call CoInitialize. At common applications VCL does it automatically. SDAC cannot execute CoInitialize itself as it may cause unexpected problems at another parts of the program also using OLE. Especially it concerns CoUninitialize and CoInitializeEx calls.