?
Solved

Error using MFC DAO to connect to an Access database under windows xp

Posted on 2004-04-23
5
Medium Priority
?
1,007 Views
Last Modified: 2010-07-27
Hi experts,

I'm using visual c++ to develop an application that connects to an Access database, it's working ok with Windows 98, NT and 2000, but we were testing with PCs with Windows XP and it can't connect to the database. The application generates an Exception and only is possible to read e->m_scode.

I tried installing:

Jet 4.0 Service Pack 8 (SP8) para Windows XP  and
Microsoft Data Access Components (MDAC) 2.8

The application launches the sampe exception.

The code is simple:

----------------------------------------------------------------------------------------------------
....
cadaux = ((CCtseditApp*)AfxGetApp())->m_CurDir + _T("\\ctsedit.mdb");
cadpass = ";PWD=";
cadpass = cadpass + PASSWORD;

try{      m_Database.Open(LPCTSTR(cadaux), FALSE, FALSE, LPCTSTR(cadpass));
      }

catch( CDaoException* e )
{
          DisplayDaoException(e);
                 e->Delete();

      }
....

void DisplayDaoException(CDaoException* e)
{
 CString strMsg;
 if (e->m_pErrorInfo!=NULL)
 {
  strMsg.Format(
   _T("%s   (%d)\n\n")
   _T("Would you like to see help?"),
   (LPCTSTR)e->m_pErrorInfo->m_strDescription,
   e->m_pErrorInfo->m_lErrorCode);

  if (AfxMessageBox(strMsg, MB_YESNO) == IDYES)
  {
   WinHelp(GetDesktopWindow(),
     e->m_pErrorInfo->m_strHelpFile,
     HELP_CONTEXT,
     e->m_pErrorInfo->m_lHelpContext);
  }
 }
 else
 {
  strMsg.Format(
   _T("ERROR:CDaoException\n\n")
   _T("SCODE_CODE      =%d\n")
   _T("SCODE_FACILITY  =%d\n")
   _T("SCODE_SEVERITY  =%d\n")
   _T("ResultFromScode =%d\n"),
   SCODE_CODE      (e->m_scode),
   SCODE_FACILITY  (e->m_scode),
   SCODE_SEVERITY  (e->m_scode),
   ResultFromScode (e->m_scode));
  AfxMessageBox(strMsg);
 }
}

----------------------------------------------------------------------------------------------------
DisplayDaoException displays:

SCODE_CODE = 3633
SCODE_FACILITY=10
SCODE_SEVERITY=1
ResultFromScode= -2146824655

----------------------------------------------------------------------------------------------------

cadaux and  cadpass are right, using errlook.exe with -2146824655 the error means "Class not Registered".

Any of you had this problem? how did you fix it? we don't think we'll have to change our code but probably we'll have to include some configuration we don't have ide..


Thanks in advance!
0
Comment
Question by:cvillacr
[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
  • 2
5 Comments
 
LVL 27

Accepted Solution

by:
Dabas earned 2000 total points
ID: 10914523
Hi cvillacr:
Try installing an earlier version of MDAC (2.5?)
M$oft stopped supporting DAO after MDAC 2.6 or 2.7

Dabas
0
 

Author Comment

by:cvillacr
ID: 11226609
I found myself another solution:

It was to copy msjet35.dll in the application folder. It seems ms jet is not supported in xp.

Carlos V.
0
 
LVL 27

Expert Comment

by:Dabas
ID: 11226667
Carlos:

The earlier MDAC would have installed msjet35.dll for you, as it was supported at the time.
Did you try?

Dabas
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

752 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