_CommandPtr m_pCommand;
_ParameterPtr recnum;
m_pCommand.CreateInstance(__uuidof(Command));
m_pCommand->ActiveConnection=theApp.m_pCon;
m_pCommand->CommandText="testinfo";
m_pCommand->CommandType=adCmdStoredProc;recnum.CreateInstance(__uuidof(Parameter));recnum=m_pCommand->CreateParameter("ccc",adInteger,adParamOutput,4);
m_pCommand->Parameters->Append(recnum);
_variant_t vNull;
vNull.vt=VT_ERROR;
vNull.scode=DISP_E_PARAMNOTFOUND;
theApp.m_pRec=m_pCommand->Execute(&vNull,&vNull,adCmdStoredProc);
_variant_t var;
var=recnum->value;
这里var得到为空,请教各位怎样才能得到输出参数的值
_ParameterPtr recnum;
m_pCommand.CreateInstance(__uuidof(Command));
m_pCommand->ActiveConnection=theApp.m_pCon;
m_pCommand->CommandText="testinfo";
m_pCommand->CommandType=adCmdStoredProc;recnum.CreateInstance(__uuidof(Parameter));recnum=m_pCommand->CreateParameter("ccc",adInteger,adParamOutput,4);
m_pCommand->Parameters->Append(recnum);
_variant_t vNull;
vNull.vt=VT_ERROR;
vNull.scode=DISP_E_PARAMNOTFOUND;
theApp.m_pRec=m_pCommand->Execute(&vNull,&vNull,adCmdStoredProc);
_variant_t var;
var=recnum->value;
这里var得到为空,请教各位怎样才能得到输出参数的值
_variant_t var;
var=m_pCommand->GetParameters()->GetItem(0)->Value;//return code
var=m_pCommand->GetParameters()->GetItem(1)->Value;//output parameter
AkiraChing:我的存储过程没有返回值,我用过:var=m_pCommand->GetParameters()->GetItem((short)0)->Value;返回为空,如果用var=m_pCommand->GetParameters()->GetItem((short)1)->Value就会有异常了
_variant_t varBLOB;
int i = m_pRecordset->GetFields()->GetItem("job_id")->ActualSize; CString str = (char*)_bstr_t(m_pRecordset->GetFields()->GetItem("job_id")->Value);
AfxMessageBox( str );
return str;