I am trying to access a SQL database on a Windows 2003 server (although I would be doing this on 2000 servers as well), but when I try to call CreateInstance
with a _ConnectionPtr object, it fails with "ERROR_NO_TOKEN: 1008: An attempt was made to reference a token that does not exist." The code could not be simpler:
hResult = m_lpADOConnect.CreateInstance("ADODB.Connection");
Is there some other initialization I need to do before making this call? Thanks for all help and advice.
I figured it out. I was forgetting to call CoInitialize(NULL);
beforehand.