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

x
?
Solved

Creating DAO application

Posted on 2001-08-16
5
Medium Priority
?
275 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 100 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 100 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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…

773 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