Solved

Creating DAO application

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Whole sheet autoscrub still needed 19 48
string initialization in java 11 109
has77  challenge 9 71
scoreUp challenge 14 56
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

947 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

21 Experts available now in Live!

Get 1:1 Help Now