Maybe because you forgot to move the cursor...
Code://res is a CRecordset * that is at the first row// //get the field by name// CString sSourceField = "SOMEFIELD"; CString sSourceValue; res->GetFieldValue(sSourceField,sSourceValue); // ...here... res->MoveNext(); //now loop through by index to get all the fields// long nFields = res->GetODBCFieldCount(); for (long nIndex = 0; nIndex < nFields; nIndex++) { CString sValue; res->GetFieldValue(nIndex,sValue); //Fails to get "SOMEFIELD"'s value. Throws a CDBException //but has no description of the error!// }




Reply With Quote