I am having trouble obtaining the return value from a stored procedure using ADO. Below is a snippet of code without obtaining the value. Help is much appreciated.
_ConnectionPtr pConn;
_RecordsetPtr pRs;
_CommandPtr pCommand;
_variant_t vNull;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;
hr_db = pConn.CreateInstance(__uuidof(Connection));
hr_db = pRs.CreateInstance(__uuidof(Recordset));
hr_db= pCommand.CreateInstance(__uuidof( Command ));
CString str;
str.Empty();
str="DSN=Data";
_bstr_t strConn(str);
hr_db = pConn->Open(strConn, "sa", "", adConnectUnspecified);
pCommand->ActiveConnection=pConn;
pCommand->CommandText = "spdummysprt";
pCommand->Parameters->Append(pCommand->CreateParameter("@retval", adInteger, adParamOutput, 4));
pRs->Open(vNull, vNull, adOpenForwardOnly, adLockReadOnly, adCmdStoredProc);
_ConnectionPtr pConn;
_RecordsetPtr pRs;
_CommandPtr pCommand;
_variant_t vNull;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;
hr_db = pConn.CreateInstance(__uuidof(Connection));
hr_db = pRs.CreateInstance(__uuidof(Recordset));
hr_db= pCommand.CreateInstance(__uuidof( Command ));
CString str;
str.Empty();
str="DSN=Data";
_bstr_t strConn(str);
hr_db = pConn->Open(strConn, "sa", "", adConnectUnspecified);
pCommand->ActiveConnection=pConn;
pCommand->CommandText = "spdummysprt";
pCommand->Parameters->Append(pCommand->CreateParameter("@retval", adInteger, adParamOutput, 4));
pRs->Open(vNull, vNull, adOpenForwardOnly, adLockReadOnly, adCmdStoredProc);