Solved

DAO classes

Posted on 1998-01-25
3
308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 20 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

734 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