cvillacr
asked on
Error using MFC DAO to connect to an Access database under windows xp
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_CurDi r + _T("\\ctsedit.mdb");
cadpass = ";PWD=";
cadpass = cadpass + PASSWORD;
try{ m_Database.Open(LPCTSTR(ca daux), FALSE, FALSE, LPCTSTR(cadpass));
}
catch( CDaoException* e )
{
DisplayDaoException(e);
e->Delete();
}
....
void DisplayDaoException(CDaoEx ception* 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_strDescr iption,
e->m_pErrorInfo->m_lErrorC ode);
if (AfxMessageBox(strMsg, MB_YESNO) == IDYES)
{
WinHelp(GetDesktopWindow() ,
e->m_pErrorInfo->m_strHelp File,
HELP_CONTEXT,
e->m_pErrorInfo->m_lHelpCo ntext);
}
}
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!
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()
cadpass = ";PWD=";
cadpass = cadpass + PASSWORD;
try{ m_Database.Open(LPCTSTR(ca
}
catch( CDaoException* e )
{
DisplayDaoException(e);
e->Delete();
}
....
void DisplayDaoException(CDaoEx
{
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->
e->m_pErrorInfo->m_lErrorC
if (AfxMessageBox(strMsg, MB_YESNO) == IDYES)
{
WinHelp(GetDesktopWindow()
e->m_pErrorInfo->m_strHelp
HELP_CONTEXT,
e->m_pErrorInfo->m_lHelpCo
}
}
else
{
strMsg.Format(
_T("ERROR:CDaoException\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!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Carlos:
The earlier MDAC would have installed msjet35.dll for you, as it was supported at the time.
Did you try?
Dabas
The earlier MDAC would have installed msjet35.dll for you, as it was supported at the time.
Did you try?
Dabas
ASKER
It was to copy msjet35.dll in the application folder. It seems ms jet is not supported in xp.
Carlos V.