SDAC in Console apptype

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 5
Joined: Tue 02 Nov 2004 19:08
Location: Germany

SDAC in Console apptype

Post by chris » Mon 02 Jan 2006 21:24

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

Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 03 Jan 2006 07:50

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.

Post Reply