Solved

COM in Win32

Posted on 2000-04-25
3
301 Views
Last Modified: 2013-12-03
Im asked to write a program which will utilize MS databases.  I can write in any language I want.  I was going to use VB only because it allows access to COM objects such as ADO & DAO a lot easier than C.  But Im more familiar with using Win32 C calls and I like its efficency more, so Id like to try my hand at it in Win32.

Im not unfamiliar with COM (played with DirectX) but I haven't used it extensively.  Im wondering how I would access the DAO and/or ADO objects from within a Win32 app.  How would I find out the CLSID for it?  And how would I use CoCreateInstance() to load the components?

Thanks,
-Dan    
0
Comment
Question by:dmaroff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 75 total points
ID: 2748441
First of all, you should use ADO instead of DAO for new applications. DAO is obselete.

Using ADO in C++ with #import can be as easy as in VB. Look into the ADO documentation. There are samples and tutorials.

Microsoft ActiveX Data Objects (ADO)
http://msdn.microsoft.com/isapi/msdnlib.idc?theURL=/library/psdk/dasdk/ados4piv.htm
0
 

Author Comment

by:dmaroff
ID: 2748688
It seems do-able but for some reason, I cant seem to open a recordset using a query:

-------------------------------------
dbPtr->Open("SELECT CITY FROM INFO_FCI WHERE ZIP = 10987", _variant_t((IDispatch *)pConnection,true), adOpenKeyset, adLockOptimistic, NULL);
------------------------------------
City is a attribute and so is zip.  But yet I get a "datatype mismatch error".
It seems that ADO in C is little different in VB.  Can you shoe me a few different SQL statement examples using this function.

Also, is there a seperate query function thats part of the _recordset object where I can requery the database, or do I just have to create another recordset?

Thanks,
-Dan
0
 
LVL 23

Expert Comment

by:chensu
ID: 2749189
>But yet I get a "datatype mismatch error".

I have no idea.

>Also, is there a seperate query function thats part of the _recordset object where I can requery the database, or do I just have to create another recordset?

You may use the Requery method or use the Close and Open methods.
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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

622 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