Solved

Creating DAO application

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 35
Expand data scrubbing tool 13 32
sumDigits challenge 9 147
Way to decrease size of apk file 9 65
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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 …
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

786 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