用_RecordsetPtr怎样调用SQL Server带output参数的存储过程解决方案
用_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参数的存储过程
------解决方案--------------------
用Command。
------解决方案--------------------
数据库太需要学习了...555
调用简单的存储过程大概是这样写的
_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参数的存储过程
------解决方案--------------------
用Command。
------解决方案--------------------
数据库太需要学习了...555