Solved

DAO classes

Posted on 1998-01-25
3
296 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 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 96
mapBully challenge 6 134
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 94
how to use laptop or pad camera in vb.net windows application 2 71
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…

773 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