Solved

DAO classes

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 66
Separate into files by filename 12 67
iSeries DB2 Query 2 84
fizzArray2 challenge 1 60
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…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now