存储过程的问题,急

hxshaou 2004-04-26 12:13:04
有个表student(xuehao,xingming,age)
都是CString类型的。
写个存储过程,要求先insert一条记录
然后查询学号='001'的
问写出后的存储过程,返回的是记录集,为什么不能movefirst()
...全文
36 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
suchgoodpei 2004-04-27
  • 打赏
  • 举报
回复
关注
hxshaou 2004-04-26
  • 打赏
  • 举报
回复
m_pCmd->ActiveConnection=this->m_pConnection;
m_pCmd->CommandText="proc1";
m_pCmd->CommandType=adCmdStoredProc;
_ParameterPtr pParam1,pParam2,pParam3,pParam4;
pParam1=m_pCmd->CreateParameter("xuehao",adVarChar,adParamInput,10,(_bstr_t)p1);
m_pCmd->Parameters->Append(pParam1);
pParam2=m_pCmd->CreateParameter("name",adVarChar,adParamInput,10,(_bstr_t)p2);
m_pCmd->Parameters->Append(pParam2);
pParam3=m_pCmd->CreateParameter("age",adVarChar,adParamInput,10,(_bstr_t)p3);
m_pCmd->Parameters->Append(pParam3);
pParam4=m_pCmd->CreateParameter("birthday",adVarChar,adParamInput,10,(_bstr_t)p4);
m_pCmd->Parameters->Append(pParam4);
m_pRecordset=m_pCmd->Execute(NULL,NULL,adCmdStoredProc);
return m_pRecordset;
hxshaou 2004-04-26
  • 打赏
  • 举报
回复
create procedure proc1
@xuehao char(10),
@name char(10),
@sex char(10),
@birthday char(10),
as
insert into student values(@xuehao,@name,@sex,@birthday)
select * from student where 学号='001'
swbreath 2004-04-26
  • 打赏
  • 举报
回复
把你的存储过程以及调用方式给出代码
hxshaou 2004-04-26
  • 打赏
  • 举报
回复
up

4,017

社区成员

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

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