Solved

Creating DAO application

Posted on 2001-08-16
5
256 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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 explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now