Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBRFX Strange behaviour

Status
Not open for further replies.

maxbld

Programmer
Nov 30, 2001
8
IT
I've a puzzling problem: I open (TRRuleRS->Open(1, Query);) a recordset through the CRecordset open method inside a for cycle. I run it successfully lots of times with always same data, but sometimes, absolutely randomly and unpredictably, it throws an exception inside the following piece of MFC code:

.\VC98\MFC\SRC\DBRFX.CPP

void AFXAPI RFX_Long(CFieldExchange* pFX, LPCTSTR szName, long& value)
{
...
#ifdef _DEBUG
// Assumes all bound fields BEFORE unbound fields
CODBCFieldInfo* pODBCInfo = &pFX->m_prs->m_rgODBCFieldInfos[nField - 1];

/*line 1200*/if (pODBCInfo->m_nSQLType != SQL_C_LONG)
{
// Warn of possible field schema mismatch
if (afxTraceFlags & traceDatabase)
TRACE1("Warning: long converted from SQL type %ld.\n",
pODBCInfo->m_nSQLType);
}
#endif // _DEBUG
...
}

In the debug environment i find the cursor stuck at line 1200, where it throws an exception becouse pODBCInfo->m_nSQLType is unknown. In fact the local variables watch windows says pODBCInfo->m_nSQLType CXX0030: Error: expression cannot be evaluated.
pFX->m_prs has its regular value, it points to a class inherithed from the CRecordset base class, and here is pFX->m_prs->m_strSQL:
SELECT "IntStartStop".TypeID FROM "TarIntComb", "IntStartStop" WHERE "TarIntComb".pkID IN (SELECT IntCombID FROM "TarRuleItem" WHERE TarRuleID = 1 AND RuleElemID = 1 AND TariffID = 29) AND ("TarIntComb".IntStartID = "IntStartStop".PkID OR "TarIntComb".IntStopID = "IntStartStop".PkID) AND "IntStartStop".TypeID = 1

(Where double quotes are for Oracle compatibility).

Does anybody know of such strange happenings? Could it be due to the complex query form. Or is it simply a bug introduced by the debugger, that will be no more shown up compiling the application?

Thanks a lot.

Max.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top