ADO VC++ Beginner Question 
Author Message
 ADO VC++ Beginner Question

Hi,

Created a basic MFC single-document application using VC++ ver. 6,

added

#define INITGUID
#import "c:\Program Files\Common Files\System\ADO\msado15.dll"
    rename("EOF", "EndOfFile")
#include "icrsint.h"

to the top of the application implementation file, and placed a simple
declaration in the MyApp::InitInstance method,

ADODB::_ConnectionPtr pConn;

and received compilation errors:
error C2653: 'ADODB' : is not a class or namespace name
error C2065: '_ConnectionPtr' : undeclared identifier

Interestingly, the #import directive did create the msasdo15.tlh and
msasdo15.tli files in the debug directory, but nonetheless the compiler is
not seeing the ADODB namespace nor the 'smart pointer' to _Connection.

What am I missing here?

Jon Kotas
Boeing

_



Sun, 02 Dec 2001 03:00:00 GMT  
 ADO VC++ Beginner Question


Quote:
> Hi,

> Created a basic MFC single-document application using VC++ ver. 6,

> added

> #define INITGUID
> #import "c:\Program Files\Common Files\System\ADO\msado15.dll"
>     rename("EOF", "EndOfFile")
> #include "icrsint.h"

> to the top of the application implementation file, and placed a simple
> declaration in the MyApp::InitInstance method,

> ADODB::_ConnectionPtr pConn;

> and received compilation errors:
> error C2653: 'ADODB' : is not a class or namespace name
> error C2065: '_ConnectionPtr' : undeclared identifier

> Interestingly, the #import directive did create the msasdo15.tlh and
> msasdo15.tli files in the debug directory, but nonetheless the
compiler is
> not seeing the ADODB namespace nor the 'smart pointer' to _Connection.

> What am I missing here?

> Jon Kotas
> Boeing

> _

Insert 'rename_namespace("ADOCG")' in your #import directive as follows:
#import "C:\Program Files\Common Files\System\ADO\msado15.dll"
rename_namespace("ADOCG") rename("EOF", "EndOfFile")

Also, add the line 'using namespace ADOCG;' following your #import
directive.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Sun, 02 Dec 2001 03:00:00 GMT  
 ADO VC++ Beginner Question
OK,

This WORKS:

#include "stdafx.h"
#define INITGUID
#import <msado15.dll> rename_namespace("ADOCG") rename("EOF", "EndOfFile")
using namespace ADOCG;

THIS FAILS:

#define INITGUID
#import <msado15.dll> rename_namespace("ADOCG") rename("EOF", "EndOfFile")
using namespace ADOCG;
#include "stdafx.h"

Thanks for the suggestions.

jonathan kotas
Boeing

Quote:



> > Hi,

> > Created a basic MFC single-document application using VC++ ver. 6,

> > added

> > #define INITGUID
> > #import "c:\Program Files\Common Files\System\ADO\msado15.dll"
> >     rename("EOF", "EndOfFile")
> > #include "icrsint.h"

> > to the top of the application implementation file, and placed a simple
> > declaration in the MyApp::InitInstance method,

> > ADODB::_ConnectionPtr pConn;

> > and received compilation errors:
> > error C2653: 'ADODB' : is not a class or namespace name
> > error C2065: '_ConnectionPtr' : undeclared identifier

> > Interestingly, the #import directive did create the msasdo15.tlh and
> > msasdo15.tli files in the debug directory, but nonetheless the
> compiler is
> > not seeing the ADODB namespace nor the 'smart pointer' to _Connection.

> > What am I missing here?

> > Jon Kotas
> > Boeing

> > _

> Insert 'rename_namespace("ADOCG")' in your #import directive as follows:
> #import "C:\Program Files\Common Files\System\ADO\msado15.dll"
> rename_namespace("ADOCG") rename("EOF", "EndOfFile")

> Also, add the line 'using namespace ADOCG;' following your #import
> directive.

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.



Sun, 02 Dec 2001 03:00:00 GMT  
 ADO VC++ Beginner Question


Quote:
> OK,

> This WORKS:

> #include "stdafx.h"
> #define INITGUID
> #import <msado15.dll> rename_namespace("ADOCG") rename("EOF", "EndOfFile")
> using namespace ADOCG;

> THIS FAILS:

> #define INITGUID
> #import <msado15.dll> rename_namespace("ADOCG") rename("EOF", "EndOfFile")
> using namespace ADOCG;
> #include "stdafx.h"

When using precompiled headers, the compiler ignores anything that comes
before the #include "stdafx.h". You could put random gibberish up that and
it would still compile. You should either put the #include "stdafx.h" above
the ADO stuff, or move the ADO stuff into stdafx.h.

Jeff



Mon, 03 Dec 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. A Beginner vc++ question

2. Beginner ADO Question

3. Beginner question ADO

4. Create table in ADO (beginner's question)

5. ADO Beginner Question

6. ADO Beginner Question

7. help a beginner's question with vc!

8. VC Beginner's Exception Question...

9. Beginner VC++ question

10. Some VC++5 beginner questions

11. Dumb beginner question on VC++ dev environment

12. VC++ 1.52 Beginner Question

 

 
Powered by phpBB® Forum Software