Solved

DAO classes

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 190
Pressing cancel button with C# UI Automation 3 81
Generic progress indicator 6 117
countEvens challenge 2 112
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.

828 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