关于一个存储过和读取的问题?在线急!

hzcdc21 2003-10-07 05:36:06
存储过程
CREATE PROCEDURE surveyitem_show
@typeid bigint,
@guestid bigint
AS
select * from surveyitem where guestid=@guestid and typeid=@typeid order by selectitem asc
GO

function surveyitem_input(typeid,guestid)
Set surveyitem_comm=Server.CreateObject("adodb.Command")
surveyitem_comm.ActiveConnection=conn
surveyitem_comm.CommandText="surveyitem_show"
surveyitem_comm.Commandtype=4
surveyitem_comm.Parameters.refresh()
surveyitem_comm.Parameters(1).value=typeid
surveyitem_comm.Parameters(2).value=guestid
set rs_surveyitem_comm=surveyitem_comm.execute
end function

surveyitem_input 3,rs("id")

为什么只能读出一条记录的,用surveyitem_comm.recordcount统计时为-1!我该怎样才能读出多条记录,在线急!
...全文
57 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
angelheavens 2003-10-07
  • 打赏
  • 举报
回复
由于本人特别讨厌command对象不喜欢,特改造代码如下:
CREATE PROCEDURE surveyitem_show
@typeid bigint,
@guestid bigint
AS
select * from surveyitem where guestid=@guestid and typeid=@typeid order by selectitem asc
GO

sub surveyitem_input(typeid,guestid)
dim i
i=0 '统计记录总数
set rs_surveyitem_comm=surveyitem_comm.execute("exec surveyitem_show "&typeid&","&guestid)
if rs_surveyitem_comm.eof or rs_surveyitem_comm.bof then
while not rs_surveyitem_comm.eof
i=i+1
response.write "记录"
...
rs_surveyitem_comm.movenext
wend
end sub

surveyitem_input(3,rs("id"))
angelheavens 2003-10-07
  • 打赏
  • 举报
回复
问题出在set rs_surveyitem_comm=surveyitem_comm.execute
因为
(1)记录指针只能向下移动,surveyitem_comm.recordcount是无法统计的
(2)你要用循环语句来输出值

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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