ADO problem
-
I am writing a simple console application with MFC support in order to connect to Database using ADO. But having problems in the initial stages. The main program looks something like this:
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
_ConnectionPtr m_pConnection;HRESULT hr; if(!AfxOleInit()) { printf("\\n COM initialization failed"); }
hr = m_pConnection.CreateInstance( __uuidof( Connection ) );
if (SUCCEEDED(hr)) printf("\\n createInstance successful"); else printf("CreateInstance unsuccessful");
The problem is that CreateInstance is failing. Please tell me the problem if you find out. Oh yea, i added following lines in StdAfx.h:
include #import "C:\program files\common files\system\ado\msado15.dll" \
no_namespace \
rename( "EOF", "adoEOF" ) -
I am writing a simple console application with MFC support in order to connect to Database using ADO. But having problems in the initial stages. The main program looks something like this:
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
_ConnectionPtr m_pConnection;HRESULT hr; if(!AfxOleInit()) { printf("\\n COM initialization failed"); }
hr = m_pConnection.CreateInstance( __uuidof( Connection ) );
if (SUCCEEDED(hr)) printf("\\n createInstance successful"); else printf("CreateInstance unsuccessful");
The problem is that CreateInstance is failing. Please tell me the problem if you find out. Oh yea, i added following lines in StdAfx.h:
include #import "C:\program files\common files\system\ado\msado15.dll" \
no_namespace \
rename( "EOF", "adoEOF" )