简单的问题,急,在线等,谢谢啦

ww_cain 2006-02-26 09:07:40
CREATE PROCEDURE dbo.getUserList AS

begin
select * from dbo.[user]end
GO


DIM MyComm,MyRst
Set MyComm = Server.CreateObject("ADODB.Command")
MyComm.ActiveConnection = conn 'MyConStr是数据库连接字串
MyComm.CommandText = "getUserList" '’指定存储过程名
MyComm.CommandType = 4 '表明这是一个存储过程
MyComm.Prepared = true '要求将SQL命令先行编译
Set MyRst = MyComm.Execute
response.Write(MyRst("id"))
Set MyComm = Nothing
asp调用时,怎样用循环写出所用的记录。
这样为什么只得到一条记录
...全文
67 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
ww_cain 2006-02-27
  • 打赏
  • 举报
回复
现在好了,不知道为什么昨晚就是不行,搞得失眠去
ww_cain 2006-02-27
  • 打赏
  • 举报
回复
我的数据库有两百多条数据呀
竹林听雨2005 2006-02-27
  • 打赏
  • 举报
回复
调用存储过程:
set rs=conn.execute("exec getUserList")
if not (rs.eof and rs.bof) then
do while(not rs.eof)
response.Write(rs("id"))
rs.movenext
loop
end if
conn.close
set rs=nothing
竹林听雨2005 2006-02-27
  • 打赏
  • 举报
回复
一、数据库中是否只有一条记录,

二、既然要显示多条记录,肯定 要用到循环。
hc99 2006-02-27
  • 打赏
  • 举报
回复

CREATE PROCEDURE dbo.getUserList AS

begin
select * from dbo.[user]end
GO


DIM MyComm,MyRst
Set MyComm = Server.CreateObject("ADODB.Command")
MyComm.ActiveConnection = conn 'MyConStr是数据库连接字串
MyComm.CommandText = "getUserList" '’指定存储过程名
MyComm.CommandType = 4 '表明这是一个存储过程
MyComm.Prepared = true '要求将SQL命令先行编译
Set MyRst = MyComm.Execute
Do While Not MyRst.Eof
response.Write MyRst("id") & "<Br>"
MyRst.Movenext
Loop
Set MyComm = Nothing

如果只得到一条记录,查看你的数据库中的记录是否就一条记录.....

kaijier 2006-02-26
  • 打赏
  • 举报
回复




====CSDN 小助手 V2.5 2005年11月05日发布====
CSDN小助手是一款脱离浏览器也可以访问Csdn论坛的软件
界面:http://blog.csdn.net/Qqwwee_Com/archive/2005/11/05/523395.aspx
下载:http://szlawbook.com/csdnv2

kaijier 2006-02-26
  • 打赏
  • 举报
回复




====CSDN 小助手 V2.5 2005年11月05日发布====
CSDN小助手是一款脱离浏览器也可以访问Csdn论坛的软件
界面:http://blog.csdn.net/Qqwwee_Com/archive/2005/11/05/523395.aspx
下载:http://szlawbook.com/csdnv2

ww_cain 2006-02-26
  • 打赏
  • 举报
回复
那位大哥看看呀
ww_cain 2006-02-26
  • 打赏
  • 举报
回复
也不行呀
hc99 2006-02-26
  • 打赏
  • 举报
回复
Set MyRst = MyComm.Execute
Do While Not MyRst.Eof
response.Write MyRst("id") & "<Br>"
MyRst.Movenext
Loop
Set MyComm = Nothing
hc99 2006-02-26
  • 打赏
  • 举报
回复
Set MyRst = MyComm.Execute

response.Write(MyRst("id"))
Set MyComm = Nothing

28,391

社区成员

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

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