Hello, I am using VC++ 6.o and trying to call oracle stored procedures with ADO. I have attached the below code which is executed after establishing a connection with the database using a ODBC driver. this code throws an exception when i am trying to retrieve the record set. also can u suggest some sites/books anything else for my reference. the procedure "spproc" is as below: /********************** create procedure spproc num number; begin select bay_no into num from bay_dtl where rownum =1; end; /***************** the bay no is an integer in the bay_dtl table. /*********code********* try { _CommandPtr pCommand; _ParameterPtr pParam1;
HRESULT hr = pCommand.CreateInstance (__uuidof (Command));
if (FAILED (hr)) { AfxMessageBox ("Can't create an instance of Command"); return; } pCommand->ActiveConnection = m_pConn; pCommand->CommandText = "spproc"; pCommand->CommandType = adCmdStoredProc; _RecordsetPtr pRecordset; hr = pRecordset.CreateInstance (__uuidof (Recordset)); if (FAILED (hr)) { AfxMessageBox ("Can't create an instance of Recordset"); return; }
pRecordset = pCommand->Execute(NULL,NULL,adCmdStoredProc); CString strContent; /* throws an exception here strContent = (char *) (_bstr_t) pRecordset->Fields->GetItem ("bay_no")->Value;
AfxMessageBox(strContent); } thanks in advance
|