Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dineshk
Starting Member
5 Posts |
Posted - 2004-12-16 : 00:17:30
|
| try { _CommandPtr pCommand; _ParameterPtr pParam1; VARIANT vtRoyalty; HRESULT hr = pCommand.CreateInstance (__uuidof (Command)); if (FAILED (hr)) { AfxMessageBox ("Can't create an instance of Command"); return; } //Define Integer/variant. vtRoyalty.vt = VT_I2; vtRoyalty.iVal = 9; pCommand->ActiveConnection = m_pConn; //m_pConn is my connection object pCommand->CommandText = "sp_get_flag"; //sp_ge_flag is stored proc having only one parameter, 'flag' , which is output pCommand->CommandType = adCmdStoredProc; pParam1 = pCommand->CreateParameter( _bstr_t ("flag"), adInteger, adParamOutput, sizeof(int), vtRoyalty); pCommand->Parameters->Append( pParam1); _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); pRecordset->Close ();} catch (...){ TRACE ( "*** Unhandled Exception ***" );}Above is my code where i am trying to get output value. But i am not able to get the value in vtRoyalty.Can any body helpme? |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-12-16 : 05:29:27
|
| you may need a myvar = pCommand.parameters("flag").valuestatement after the EXECUTE line.am not familiar with this languague...but the above is required in VB....so am presuming something similar may work/be required for you. |
 |
|
|
|
|
|