ODBC / MFC: Numbers are mapped to String
408848Nov 12 2003 — edited Dec 4 2003Somebody else had a comparable problem a few months ago, but so far I found no solution.
We have fields in the database defined as number(11). When we read them via ODBC (using the latest Oracle ODBC driver) in Visual C++ 6.0 (service pack 4) with CRecordSet it is mapped to CString instead to a long.
Here a code example:
----------------------------------------------
CRecordset SzName(&DB);
CString SQLQueryText;
CDBVariant varValue;
SQLQueryText.Format("SELECT * FROM ACTION");
SzName.Open(CRecordset::forwardOnly, _T(SQLQueryText), CRecordset::readOnly);
SzName.GetFieldValue("STATE",varValue);
----------------------------------------------
STATE is defined as number(11) and varValue interprets it as a string!
Any ideas how to solve this problem?
Thank you very much for your help.
-- Frank