Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> ODBC Invalid Column Error // If you can solve this... You Rock

ODBC Invalid Column Error // If you can solve this... You Rock

From: <jerry_t_at_my-dejanews.com>
Date: Fri, 26 Feb 1999 20:22:55 GMT
Message-ID: <7b6vqk$qoa$1@nnrp1.dejanews.com>


I am having a problem using ODBC with an Oracle 7.3.2.3 database. My code fragment is at the bottom. The short of it is...

When I attempt:

        m_pSum.GetODBCFieldInfo(l_fldcount, fldinfo);

I get an Exception: Invalid Column Number

I have been unable to find any mention of why this doesn't work. I have even hardcoded a number into the first field that I believe is a valid column number. I have traced through to the MACRO that calls the ODBC call, and in its checking it makes sure that the column number is between 0 and N where N is the total # of columns. I have also tried using the column name, and it also returns the same error. In fact, it retrieves the index of the column by using a function to replace the name with the number of the column, and it returns the same index that I provided. I am guessing that the problem is on the Oracle side, but I am not sure where to go from here.

Thanks,
Jerry



Code

NOTE: m_pSum is a CRecordSet

  m_pSum.m_pDatabase = GetDatabase(); // Opens database connection   CString querystr = "SELECT * FROM LVW_PRED_SUM";   try
{

   m_pSum.Open(AFX_DB_USE_DEFAULT_TYPE,querystr);   }
  catch( CDBException* e )
{

   AfxMessageBox( e->m_strError, MB_ICONEXCLAMATION );      // Need to Delete the incomplete recordset object    e->Delete();
   return;
  }
  CString fldData;
  CODBCFieldInfo fldinfo;
  while (m_pSum.IsEOF() != TRUE)
{

    short retRow;
    for (short l_fldcount = 0; l_fldcount < nFields; l_fldcount++)

       {
            m_pSum.GetODBCFieldInfo(l_fldcount, fldinfo);      // do
something with Info
        ...
        }

    }

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Fri Feb 26 1999 - 14:22:55 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US