Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Accessing queries internal to a database w/ ODBC and VC++ 1.52

Posted on 1998-07-17
9
Medium Priority
?
186 Views
Last Modified: 2013-11-20
We're doing Win3.1 deveopment at work, and I need to access queries that are
stored in an Access 2.0 .mdb file, using ODBC 2.1.  Any solutions?
0
Comment
Question by:bry
[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
  • 4
  • 3
  • 2
9 Comments
 
LVL 7

Expert Comment

by:psdavis
ID: 1319410
Use the CRecordset class to open up the query very much like a regular recordset.

Phillip

0
 

Expert Comment

by:bobplace
ID: 1319411
Use CDaoQueryDef.  It will open the query for you.  Then you can open a CDaoRecordset using the CDaoquerydef ratehr than a CDaoDatabase.
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1319412
We both wish.  CDaoQueryDef is 32-bit.  We're still 16-bit ODBC aren't we?

Phillip

0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 

Author Comment

by:bry
ID: 1319413
Please note: ODBC is *NOT* DAO.  I cannot use CDaoQueryDef
because DAO wasn't around when VC++ 1.52 was released, hence
it's version of MFC does not support DAO.  I'm trying to
port this app from MFC 4.2 to MFC 2.5 (or whatever it is that
shipped w/ VC++).

0
 

Expert Comment

by:bobplace
ID: 1319414
Oh, I see you are moving to a lower platform.  Sorry I gave up on the 16 bit world several years ago.  Never mind....
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1319415
If all you're trying to do is port a Win32 program down to Win16, how about Win32s?  I believe that you still gain your DAO implementation, and it should help with absolutely everything else you're trying to convert.

Phillip

0
 

Author Comment

by:bry
ID: 1319416
We've already tried Win32s, and there are some problems w/ it
(particularly w/ property sheets).  Also, it slows Win3.1
down a bit, and we're having problems with speed already (we
have a 200,000-entry database to manipulate).

I may have found a solution, though.  I'll have to wait 'til
I get to work tomorrow to see what happens.

Thanks

Bry
0
 

Author Comment

by:bry
ID: 1319417
Okay, the problem is fixed -- here's what needs to be done, for
those out there who are doing Win3.1 development:

1. Create a CRecordset w/ ClassWizard that accesses one of the
tables that your query uses

2. Add/delete member variables from your recordset class to
reflect the columns of data returned by the query - you may
have to add some manually outside the ClassWizard-defined
braces

3. Initialize your vars, and also edit the Record Field Exchange
part of your class to reflect the vars you added - note if you
have parameters you want to send to the query, you will also
have to add those member vars and set them up in the Field
Exchange as well - see the docs

4. You're now ready to open the query.  First, initialize all
your parameters (if you have them) w/ whatever data you want
to send to the query.  Then, construct a CString as follows:

CString mySQL = _T("{CALL myquery ( <params> )}");

where 'myquery' is the name of the query stored in the DB.
Then create an instance of your recordset, and open it with:

myCRecordSet.Open(CRecordset::snapshot, mySQL, CRecordSet::readOnly);

This will open the query and begin the Field Exchange as normal.


PS -
I don't know how to get the points back, so I guess the first
person who responds can have them.
0
 
LVL 7

Accepted Solution

by:
psdavis earned 400 total points
ID: 1319418
I'll go ahead and claim them if you don't mind!

Phillip

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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 response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

721 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