Solved

ADO 2.5 Connections in Visual C++ 6

Posted on 2000-03-14
6
382 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

776 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