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

x
?
Solved

DAO classes

Posted on 1998-01-25
3
Medium Priority
?
318 Views
Last Modified: 2013-11-20
I have such problem:
I'm writting program that uses DAO classes and when i build it with MFC as static library everything is OK. But when build it with MFC as shared library, when I run it an exception occurs (Unable to initialize DAO/Jet db engine).
  Why it happens?

(sorry for my English :-( )
0
Comment
Question by:thesyo
3 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1314761
It shouldn't happen and I have built many components that use MFC as a shared library without any problems whatsoever. Which version of Visual C++ (or MFC) are you using? I would make sure that you have created a CDaoWorkspace and initialized the CDaoEngine properly. You might want to post your initialization code.
0
 

Author Comment

by:thesyo
ID: 1314762
First of all i'm using VC++ 4.2 (and in my MFC there isn't CDaoEngine class)

And second, i don't think that it's coused by error in initialization becouse it WORKS when it's linked with MFC static library.

To initialize dao I create new CDaoDatabase object (it uses default workspace) in CDocument::OnNewDocument()

m_Data->Open("blahblah");
0
 

Accepted Solution

by:
pdolbey earned 40 total points
ID: 1314763
MS knowledge base article Q168004 "Unable to initialise DAO/Jet db Engine" explains the cause of this problem. Its very simple. With VC 4.2, MS shipped DAO 3.0, but with VC 5.0 DAO was upgraded to 3.5. For this to work with MFC, DAOCORE.CPP was incorrectly modified as shown in the article. This error meant that DAO 3.0 would not operate with MFC. This fault was deployed in MFC42.DLL Version 4.21.7022 with the initial release of VC++ 5.0. Now the last version (I had) of an MFC42.DLL which worked happily with VC++ 4.2 was 4.21.5160. What has happened is that a third party program has "infected" you with the faulty DLL, since its version number was greater than your orginal. You should find that either linking to static libraries, or using the debug version (i.e. MFC42D.DLL) will remove the problem. (If this is not the case then I am barking up the wrong tree!)

The fault in MFC42.DLL was removed in service pack 1. I am currently using the version from SP3 which is 4.21.7303 which works with both VC++ 4.2/DAO 3.0 and VC++ 5.0SP3/DAO 3.5.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
In this post we will learn different types of Android Layout and some basics of an Android App.
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 summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses

783 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