Re: ADO in multithreaded: Application Verifier (with WinDbg) gives "Invalid Handle" at the end of my application

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



The following is an excerpt from the code:
::Coinitialize(NULL)

Why aren't you examining the return value of ::Coinitialize(NULL) ?
It can be S_OK, S_FALSE or something else. If it is something else, you are
in trouble.
If S_FALSE it has already been initialised.
I only call ::CoUninitialize() if I get a return value of S_OK from
::Coinitialize()

hr = adoConnection->Open("", "", "", adModeUnknown);

The adModeUnknown is wrong and is probably confusing ADO.
It is for setting the Connection Mode property
Instead it should be one of the 2 enums in the ConnectOptionEnum:
adAsyncConnect or adConnectUnspecified
See
http://msdn2.microsoft.com/en-us/library/ms678189.aspx

Stephen Howe


.