954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Ado connection problem

hi
i created an application in vc++/MFC
now iam using ado to connect to the databaase
but there is aproblem i couldnot find any solution for it ....pleeease help
the problem is this error :
error C2146: syntax error : missing ';' before identifier 'm_pConn'
while iam defining : in stdafx.h
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" \
no_namespace \
rename( "EOF", "adoEOF" )

and in the main class i define :
public:
_ConnectionPtr m_pConn;

i searched about this error and it all seemed about the # import
but i couldnot find any anything wrong about it
pleeease help me
its driving me crazy

lahom
Light Poster
42 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

Check in the generated msado15.tlh if it contains the ADODB namespace.
i.e. see can you find the following in it

#include <comdef.h>

namespace ADODB {
...


I guess it does, in which case you can use either

using namespace ADODB;

// or

ADODB::_ConnectionPtr m_pConn;


Which compiler are you using?

mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You