I am calling it with
#define TESTCONNECT _T("Provider=SQLOLEDB;Integrated Security=SSPI;Data
Source=(local)")
...
hr = _Connection_Open(cndb, TESTCONNECT, _T(""), _T(""), -1);
I would like to know how to fix this error which even already I am
suspecting to be due to the fact that TESTCONNECT is not BSTR, however, I
would like to know how to get from that HRESULT to a meaningful message, when
calling functions of the ADO library.
I am using the SDK not visual studio/ATL/MFC, so _com_issue_error and
anything else in <comutil.h> is out.
For system-defined HRESULTs, use
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM). If you want to see it while
debugging, put a variable into the Watch window and type ",hr" (without
quotes) after the variable name. There's also Error Lookup tool under
Tools menu in the IDE.
> I am using ADO via COM, and am getting the following HRESULT
> when I try to call _Connection_Open:
>
> -2147467259
That would be 0x80004005 E_FAIL "Unspecified error".
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
Helpful, eh? :-) No, I don't mean your reply, I mean MS'
error codes.
I can guess what lpBuffer and nSize are for...
What about dwMessageID, dwLanguageID and va_list?
Can I just pass NULL to these?
I know, good aren't they! :-)
My favourite is "Unknown catastrophic failure".
Or is it just "Catastrophic failure"?
(as if that would be a known unknown..)
Why don't you go just one step further and actually read the complete
docs page? Which part of this do you have difficulty understanding:
If neither of these flags is set in dwFlags, then lpSource is ignored.
dwMessageId - Message identifier for the requested message.
> I can guess what lpBuffer and nSize are for...
Why do you feel the need to guess? Presumably, you are literate, so why
can't you just read the documentation in lieu of guesswork?
Well, I didn't want to get bogged down in things that were irrelevant, such
as language id.
>
> If neither of these flags is set in dwFlags, then lpSource is ignored.
> dwMessageId - Message identifier for the requested message.
Right, OK - so dwMessageID is the HRESULT...the only difficulty I had in
unerstanding that was that an HRESULT could be represented by an LPCVOID
*or* a DWORD, if one of the parameters was of type HRESULT, I would have
understood it instantly. Likewise, I would have got it if it had said "this
parameter can take a message code, such as an HRESULT". Sorry if I was a bit
slow.
So, as you didn't want to get "booged down", you asked this newsgroup to do
all the "bogging down" for you, right?
Arnaud
MVP - VC
"Arnaud Debaene" <adeb...@club-internet.fr> wrote in message
news:%23VLNP79...@TK2MSFTNGP12.phx.gbl...