您现在的位置: 网页制作教程网 >> 网络编程 >> Asp教程 >> ASP基础教程 >> 文章正文

ASP开发中存储过程应用详解

作者:动态网站…

来源:动态网站制作指南

热度:

2007-6-30 14:28:14

'以下显示记录
if recordcount = 0 then
Response.Write "无记录"
elseif recordcount > 0 then
MyRst.open
do until MyRst.EOF
......
loop
'以下显示分页信息
......
else 'recordcount=-1
Response.Write "参数错误"
end if

  对于以上代码,只有一点需要说明:同时返回记录集和参数时,若要取得参数,需先将记录集关闭,使用记录集时再将其打开。

  7. 返回多个记录集的存储过程

  本文最先介绍的是返回记录集的存储过程。有时候,需要一个存储过程返回多个记录集,在ASP中,如何同时取得这些记录集呢?为了说明这一问题,在userinfo表中增加两个字段:usertel及usermail,并设定只有登录用户可以查看这两项内容。


/*SP7*/
CREATE PROCEDURE dbo.getUserInfo
@userid int,
@checklogin bit
as
set nocount on
begin
if @userid is null or @checklogin is null return
select username
from dbo.[usrinfo]
where userid=@userid
--若为登录用户,取usertel及usermail
if @checklogin=1
select usertel,usermail
from dbo.[userinfo]
where userid=@userid
return
end
go

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页


我来说两句:

1分 2分 3分 4分 5分
姓名: *


* 请各位网友遵纪守法并注意语言文明。
网站简介 | 联系方式 | 意见建议 | 版权说明
Copyright © 2007 All rights reserved
滇ICP备06006992号