Solved

Creating DAO application

Posted on 2001-08-16
5
263 Views
Last Modified: 2013-11-20
Hi,

I  built an MFC application .
I Inserted a new class using the wisard.
The class I want to insert to my project should dervied from the CRecordset class, and the datasource should be DAO.
when I chose the path of the mdb file (the accsses DB),I was informed with the message that the file format was unrecognized.
That mdb file was created by office 2000.
when I tried to connect a file that was created by office 97, I did well !!!!

what I'm asking is how to coonect to mdb files that were created by the office 2000 (and not only by the 97)???
I tried to install the SP4 of the Visual studio, but no help.
I wonder if a higher version of SP will help, or maybe I should use another solution....

Thank you in advance !!!!!

0
Comment
Question by:kukiya
5 Comments
 
LVL 7

Accepted Solution

by:
jimwasson earned 25 total points
ID: 6392993
You need to force MFC to load the Jet4.0 dlls by putting in the following line:

     AfxGetModuleState()->m_dwVersion = 0x0601;

very early into your Application class's InitInstance() function or your WinMain().

The reference is Microsoft Knowledge Base article Q236991.
0
 

Author Comment

by:kukiya
ID: 6393536
I also tried to convert the Database to a prior version, and that helped.

But I would like to have a solution coming from the visual studio...
Thanks.
0
 

Assisted Solution

by:Thomas_Dzieran
Thomas_Dzieran earned 25 total points
ID: 6397191
Hi kukiya!
This error happens because the MFC DAO classes
shiped with Visual C++ 6.0, load DAO 3.5 (Dao350.dll) by default

To link with the MFC DLL, you can specify that
you want MFC to use DAO 3.6 by inserting the following line
of code before you open an Access 2000 database:

AfxGetModuleState()->m_dwVersion = 0x0601;
Insert this line in the CYourApp::Initinstance()
function of your program.

If you are building with static MFC libs, it is little bit more complicated,
and there is an excellent article from Microsoft:
http://support.microsoft.com/support/kb/articles/q236/9/91.asp
just follow this link.
Let me know if it helped.
Thomas Adam Dzieran.
0
 

Author Comment

by:kukiya
ID: 6403071
OK,thanks for helping me...

  But I am still wondering...
How can I create a class that inherits CRecordset and uses the DAO by the Wisard at the design time ??????

As I understand , above is the soultion at run time .....
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9521212
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: Thomas_Dzieran, jimwasson (points to be split)

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error on moodle after upgrade 3 140
no14 challenge 14 72
haveThree challenge 22 121
How do I get Window Title of all opened process? 4 14
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

828 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