Error when calling stored procedure from CRecordset
-
Hello, I am using MFC to call a stored procedure written in Oracle PL/SQL, but when I make the call I get the next error in Spanish: "No se enlazaron columnas antes de llamar a SQLFetchScroll o SQLExtendedFetch", which more or less in English means: "No rows were binded before calling SQLFetchScroll or SQLExtendedFetch". I am using a CRecordset derived class to access the stored procedure. I am unable to find the error. THE STORED PROCEDURE'S HEADER: Sp_Int_Ot_Ordendetrabajoalta ( lineatrabajo NUMBER, lv_orden NUMBER, usuario VARCHAR2, idvehiculo NUMBER, fechamax1 VARCHAR2, resumen VARCHAR2, detalle VARCHAR2, coderp VARCHAR2, numtrabrecibidos NUMBER, lv_CODOT VARCHAR2, retorno OUT INTEGER) THE .H FOR THE CRECORDSET DERIVED CLASS (Visual Studio 6 comments removed) class CRecSP : public CRecordset { public: CRecSP(CDatabase* pDatabase = NULL); DECLARE_DYNAMIC(CRecSP) CString m_szSQL; long m_RETORNO; virtual CString GetDefaultConnect(); virtual CString GetDefaultSQL(); virtual void DoFieldExchange(CFieldExchange* pFX); }; THE .CPP FOR THE CLASS (VS6 comments removed) IMPLEMENT_DYNAMIC(CRecSP, CRecordset) CRecSP::CRecSP(CDatabase* pdb) : CRecordset(pdb) { m_RETORNO = 0; m_nParams = 1; m_nDefaultType = snapshot; } CString CRecSP::GetDefaultConnect() { return _T( DB_CONNECTION_STRING ); } CString CRecSP::GetDefaultSQL() { return m_szSQL; } void CRecSP::DoFieldExchange(CFieldExchange* pFX) { pFX->SetFieldType(CFieldExchange::outputParam); RFX_Long(pFX, _T("[retorno]"), m_RETORNO ); } USING THE CRECORDSET DERIVED CLASS: (Vars read from EditBoxes as CStrings and formatted in the SQL) CRecSP *rec = new CRecSP(&db); szSQL.Format( "{CALL FGROT2005.SP_INT_OT_ORDENDETRABAJOALTA(%s,%s,'%s',%s,'%s','%s','%s','%s',%s,'%s',?)}", szLinea, szOrden, "USER", szIdVeh, szFechaMax, szResumen, szDetalle, "ERP", "0", szCodOT ); rec->m_szSQL = szSQL; //rec->Open( CRecordset::forwardOnly,szSQL,CRecordset::readOnly ); rec->Open( ); iError = rec->m_RETORNO; rec->Close(); -- modified at 3:49 Tuesday 6th September, 2005