调用简单的存储过程大概是这样写的
_RecordsetPtr rs;
COleVariant vtOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR);
CString strSQL;
strSQL.Format("exec proc_test '%s'", pNumber);
rs=td.thread_pselect_conn->Execute(_bstr_t(strSQL), &vtOptional, adCmdUnspecified);
int nType = (int)(rs->GetCollect("Type"));
现在有个带output参数的存储过程,那我就照葫芦画瓢咯,可是总报错
_RecordsetPtr rs;
COleVariant vtOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR);
CString strSQL;
strSQL.Format("declare @Type int exec proc_test '%s', @Type output select @Type as Type", pNumber);
rs=td.thread_pselect_conn->Execute(_bstr_t(strSQL), &vtOptional, adCmdUnspecified);
int nType = (int)(rs->GetCollect("Type"));请问一下,用_RecordsetPtr怎样调用SQL Server带output参数的存储过程
_RecordsetPtr rs;
COleVariant vtOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR);
CString strSQL;
strSQL.Format("exec proc_test '%s'", pNumber);
rs=td.thread_pselect_conn->Execute(_bstr_t(strSQL), &vtOptional, adCmdUnspecified);
int nType = (int)(rs->GetCollect("Type"));
现在有个带output参数的存储过程,那我就照葫芦画瓢咯,可是总报错
_RecordsetPtr rs;
COleVariant vtOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR);
CString strSQL;
strSQL.Format("declare @Type int exec proc_test '%s', @Type output select @Type as Type", pNumber);
rs=td.thread_pselect_conn->Execute(_bstr_t(strSQL), &vtOptional, adCmdUnspecified);
int nType = (int)(rs->GetCollect("Type"));请问一下,用_RecordsetPtr怎样调用SQL Server带output参数的存储过程
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货