请问:如何用ADO执行存储过程并返回OUTPUT值及记录集

asoftcn 2005-03-22 05:35:48
CAdoCommand m_adoCommand;
m_adoCommand.SetConnection(&m_adoConnection);
m_adoCommand.SetCommandType(adCmdStoredProc);
m_adoCommand.SetCommandText("PROC_USER_CHECKUSERA");
_ParameterPtr param;
//////////////////////////////////////////////////////
param =m_adoCommand.CreateParameter("UserCode",adBigInt, adParamInput,sizeof(long),_variant_t("100000"));

m_adoCommand.Append(param);
param=m_adoCommand.CreateParameter("IsPass",adBigInt, adParamOutput, sizeof(long),(long)(0));
m_adoCommand.Append(param);

CAdoRecordSet m_adoRecordSet
m_adoRecordSet = m_adoCommand.Execute(adCmdStoredProc);
long b=(long)m_adoCommand.GetParameters()->GetItem("IsPass")->GetValue();

结果m_adoRecordSet 记录集能得到但IsPass返回值b得不到,如果将执行语句改成:
m_adoCommand.Execute(adCmdStoredProc); 直接执行,那么IsPass返回值b就能正确的得到
请问各高手,这是什么问题如何处理!

...全文
157 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hydra2004 2005-05-26
  • 打赏
  • 举报
回复
先关闭记录集,就可以取到output参数了
wxp 2005-04-19
  • 打赏
  • 举报
回复
我有用VC2003条通的例子,但你的信誉太低,能保证给分吗?
asoftcn 2005-03-23
  • 打赏
  • 举报
回复
帮助三!

4,017

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧