Solved

ADO 2.5 Connections in Visual C++ 6

Posted on 2000-03-14
6
383 Views
Last Modified: 2013-11-20
I've instaled ADO 2.5 in a Win 98  machine.

All works ok form VB and VBA, but i can't get it to work in Visual C++.

I'm using a _ConnectionPtr variable but create instance allways fails.

the follwing code allways fails

_ConnectionPtr mConn;

hr = mConn.CreateInstance ("ADODB.Connection");
 if(FAILED(hr))
 {
   mConn = NULL;
   return FALSE;
 }

also i've tried to replace "ADODB.Connection" (wich should be ok, cos i can create the object using a simple CreateObject in VB) by
__uuidof(_Connection)
0
Comment
Question by:PedroG
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:Wyn
ID: 2615218
0
 
LVL 5

Expert Comment

by:Wyn
ID: 2615223
0
 
LVL 5

Expert Comment

by:Wyn
ID: 2615229
Check above and I think it will clear all problems and you will gain more details...

Regards
W.Yinan
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 2

Author Comment

by:PedroG
ID: 2615344
Guys i do not need to be tought how to work with ADO. I only can't creat a ConnectionPtr object!!!

AND BELEIVE ME THAT I'VE TRIED ALL THE WAYS THAT ARE IN THE MSDN
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 2616523
What is the value of hr? You probably forgot to call CoInitializeEx().
0
 
LVL 2

Author Comment

by:PedroG
ID: 2618825
Yes that is write, i've founded that out yesterday
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Expand to include initial dialog with two choices. 9 80
bigDiff challenge 17 126
noX challenge 17 129
Bartender label printing - switch on and off graphics 3 54
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question