I'm migrating a vc6.0 code base to vs 2008. MS Access database is used. while trying to open mdb file CRecordset's Open is throwing Exception (Too few parameters. Expected 4).
int CDB::OpenConnection(CString strDSN, CString& strErr)
m_pPointSet = new CPointSet(&m_Database);
m_pGlobalSet = new CGlobalSet(&m_Database);
m_pFormulaSet = new CFormulaSet(&m_Database);
if(!m_pEbExportSet->Open())
{
TRACE("*********DB's Connec Error Code in EbExportSet Open : %d", DB_CONNECTION_ERROR);
return DB_CONNECTION_ERROR;
}
else
{
TRACE("**************No Exception " );
}
if(!m_pFormulaSet->Open())
{
TRACE("*********DB's Connec Error Code in FormulaSet Open : %d", DB_CONNECTION_ERROR);
return DB_CONNECTION_ERROR;
}
else
{
TRACE("**************No Exception " );
}
if(!m_pGlobalSet->Open())
{
TRACE("*********DB's Connec Error Code in GlobalSet Open : %d", DB_CONNECTION_ERROR);
return DB_CONNECTION_ERROR;
}
else
{
TRACE("**************No Exception " );
}
}
CATCH_ALL( e )
{
LPTSTR lpErr = strErr.GetBuffer(255);
e->GetErrorMessage(lpErr, 255);
strErr.ReleaseBuffer();
TRACE("Error String : %s ", strErr);
LogException(strErr, "OpenConnection");
TRACE("................logged.............\n");
return DB_EXCEPTION;
}
END_CATCH_ALL
return SUCCESS;
}
m_pEbExportSet, m_pFormulaSet, m_pGlobalSet are objects of class derived from CRecordset. Only m-pGlobalset->Open() is throwing exception, remaining is working fine.
The Exception is thrown after coming out of CGlobalSet:oFieldExchange(CFieldExchange* pFX).
But this Open() is working fine in VS2008 environment (ie when I execute using Ctrl+F5 or F5), but after building when I run exe its not working!
Bookmarks