ASP通过 rs 取得存储过程返回的两表,第二个表怎么取得。

伊点阳光 2006-11-16 05:03:04
存储过程: declare @TotalCount int declare @PageCount int declare @PageIndex int declare @StartRow int select @TotalCount=count(*) from testtable where 1=1 if @PageCount <= 0 begin select id,firstname,lastname,country,note from testtable where 1<>1 select 0 as PageIndex,0 as PageCount,10 as PageSize,0 as TotalCount return end set @PageCount=(@TotalCount+10-1)/10 set @PageIndex=6000 if @PageIndex<0 set @PageIndex=1 if @PageIndex>@PageCount and @PageCount>0 set @PageIndex=@PageCount set @StartRow=(@PageIndex-1)*10+1 declare @Sort varchar(100) set rowcount @StartRow select @Sort=id from testtable where 1=1 order by id asc set rowcount 10 select id,firstname,lastname,country,note from testtable where 1=1 and id>=@Sort order by id asc select @PageIndex as PageIndex,@PageCount as PageCount,10 as PageSize,@TotalCount as TotalCount
id firstname lastname country note
----------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- -------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
59990 firstname_xxx_59990 astname_xxx_59990 country_xxx59990 note_xxx59990
59991 firstname_xxx_59991 astname_xxx_59991 country_xxx59991 note_xxx59991
59992 firstname_xxx_59992 astname_xxx_59992 country_xxx59992 note_xxx59992
59993 firstname_xxx_59993 astname_xxx_59993 country_xxx59993 note_xxx59993
59994 firstname_xxx_59994 astname_xxx_59994 country_xxx59994 note_xxx59994
59995 firstname_xxx_59995 astname_xxx_59995 country_xxx59995 note_xxx59995
59996 firstname_xxx_59996 astname_xxx_59996 country_xxx59996 note_xxx59996
59997 firstname_xxx_59997 astname_xxx_59997 country_xxx59997 note_xxx59997
59998 firstname_xxx_59998 astname_xxx_59998 country_xxx59998 note_xxx59998
59999 firstname_xxx_59999 astname_xxx_59999 country_xxx59999 note_xxx59999

(所影响的行数为 10 行)

PageIndex PageCount PageSize TotalCount
----------- ----------- ----------- -----------
6000 10001 10 100001

(所影响的行数为 1 行)




以上为分页存储过程所返回的值。
返回值会返回两个表,通过以下方法取得:
sql="NFS_Dgcd_Net_YangYi_sp_PageSplitGood 'id','id,firstname,lastname,country,note','testtable','','id asc',6000,10"
set rs=conn.execute(sql)
这种方法只能取得第一个表的对象,取不到第二个表的对像。
ASP中怎么操作才能取得每二个表的值
...全文
293 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
yjbnew 2006-11-18
  • 打赏
  • 举报
回复
这个不更加简单吗
set rs2=rs.nextrecordset
rs2...
rs...


这样不行哟,rs已经把指针移到第二个表了,再移到上一个表就不得行了哟。
-----------
那就这样:
set rs2=rs
set rs=rs.nextrecordset
伊点阳光 2006-11-18
  • 打赏
  • 举报
回复
这个不更加简单吗
set rs2=rs.nextrecordset
rs2...
rs...


这样不行哟,rs已经把指针移到第二个表了,再移到上一个表就不得行了哟。
yaomingming0108 2006-11-18
  • 打赏
  • 举报
回复
我司招聘程序开发工程师,一经录取待遇从优,具体情况请详见www.yuyao.com
yjbnew 2006-11-18
  • 打赏
  • 举报
回复
这个不更加简单吗
set rs2=rs.nextrecordset
rs2...
rs...
sh_city 2006-11-18
  • 打赏
  • 举报
回复
语法

Set recordset2 = recordset1.NextRecordset( RecordsAffected )

返回值

返回 Recordset 对象。在语法模型中,recordset1 和 recordset2 可以是相同的 Recordset 对象,否则可以使用不同的对象。

xiesongque 2006-11-18
  • 打赏
  • 举报
回复
学习
那个存储过程那么长,好难读哦
craft001wen 2006-11-18
  • 打赏
  • 举报
回复
呵呵,这样也行,绝了!
顶个
hymxtang 2006-11-18
  • 打赏
  • 举报
回复
进来学习~~
伊点阳光 2006-11-17
  • 打赏
  • 举报
回复
还有一个问题:
我得到第二表的值后,怎么再返回第一表。
coolid 2006-11-17
  • 打赏
  • 举报
回复
头次见到
yjbnew 2006-11-17
  • 打赏
  • 举报
回复
Set rs = rs.NextRecordset 就是下一个
伊点阳光 2006-11-17
  • 打赏
  • 举报
回复
谢谢大家,Set rs = rs.NextRecordset 就是下一个
这个方法果然毒辣
nevana 2006-11-16
  • 打赏
  • 举报
回复
跟着钻石顶啊,呵呵,不过看到楼主的问题又想到还是.net里面的datset好啊,无所谓几个表了,比ASP方便多了!
银狐被占用 2006-11-16
  • 打赏
  • 举报
回复
钻石老大都来了。那答案更错不了了。。。
孟子E章 2006-11-16
  • 打赏
  • 举报
回复
Set rs = rs.NextRecordset 就是下一个
孟子E章 2006-11-16
  • 打赏
  • 举报
回复
rs.NextRecordset
孟子E章 2006-11-16
  • 打赏
  • 举报
回复
rs.NextResult

28,406

社区成员

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

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