Can't instanciate Errors object in C++/MFC dialog app == :-(



My overall goal is to use ADO to execute some simple sql commands. I
can instantiate and Open() a Connection object, but Execute() results
in a _com_error exception. I'm trying to get at the error info, and I
believe that I have to instantiate an Errors object to do so. However,
instantiation fails, "Class not registered", on my XP SP2 machine w/
MDAC 2.81.1117.0.


Here's some code from a C++/MFC dialog app that illustrates my problem
instantiating the Errors object:

....
#import "C:\\Program Files\\Common Files\\System\\ado\\msado15.dll"
rename_namespace("msado15") rename("EOF", "adoEOF")
....

BOOL CAdoNoWorkyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
AfxEnableControlContainer();
OleInitialize(NULL);
msado15::ErrorsPtr errors;
HRESULT hr = errors.CreateInstance(__uuidof(msado15::Errors));
if(FAILED(hr))
{
return false;
}
return TRUE;
}
....

The HRESULT comes back as:

0x80040154 Class not registered.

My copy of msad015.tlh contains this:

struct __declspec(uuid("00000501-0000-0010-8000-00aa006d2ea4"))
Errors : _Collection

and that GUID does appear in my registry, so I conclude that the class
I want to instantiate is at least partially registered.

What am I doing wrong?

Thanks in advance!
Jeff

.



Relevant Pages