Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 391
  • Last Modified:

ADO 2.5 Connections in Visual C++ 6

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
PedroG
Asked:
PedroG
  • 3
  • 2
1 Solution
 
WynCommented:
0
 
WynCommented:
Check above and I think it will clear all problems and you will gain more details...

Regards
W.Yinan
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
PedroGAuthor Commented:
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
 
Tommy HuiCommented:
What is the value of hr? You probably forgot to call CoInitializeEx().
0
 
PedroGAuthor Commented:
Yes that is write, i've founded that out yesterday
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now