I'm trying to create a database connection object like so:

_ConnectionPtr pConn = NULL;

CoInitialize(NULL);

HRESULT hr = pConn.CreateInstance((__uuidof(Connection)));

However, the CreateInstance call fails with the error "Class not
registered". I'm guessing there's some COM component not installed,
but I'm not quite sure where it comes from. Any help is
appreciated.

Thanks.

Re: COM trouble by Alex

Alex
Thu Mar 01 06:36:00 CST 2007

<bob@coolgroups.com> wrote::
> I'm trying to create a database connection object like so:
>
> _ConnectionPtr pConn = NULL;
>
> CoInitialize(NULL);
>
> HRESULT hr = pConn.CreateInstance((__uuidof(Connection)));
>
> However, the CreateInstance call fails with the error
> "Class not
> registered". I'm guessing there's some COM component not
> installed,
> but I'm not quite sure where it comes from. Any help is
> appreciated.


It means that CLSID you requested (__uuidof(Connection))
doesn't exist in Registry. Ensure that you have MDAC
properly installed.

Alex