怎么遍历输出存储过程里的数据

god_is_pig 2010-08-13 12:23:06
我是搞ASP.NET的,公司的老网站是用ASP做的,几乎要从零开始学ASP
我想问问,怎么实现循环输出存储过程中的数据???

CREATE PROCEDURE Pro_GetCom
as
set nocount on
begin
select top 5 id,diqu,company from a_company
end



DIM MyComm,MyRst
Set MyComm = Server.CreateObject("ADODB.Command")
MyComm.ActiveConnection = connstr 'MyConStr是数据库连接字串
MyComm.CommandText = "Pro_GetCom" '指定存储过程名
MyComm.CommandType = 4 '表明这是一个存储过程
MyComm.Prepared = true '要求将SQL命令先行编译
Set MyRst = MyComm.Execute
'接下来怎么写????????????
...全文
121 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
luoxj_win 2010-09-07
  • 打赏
  • 举报
回复
记住几个关键点就行了
While Not MyRst.EOF
<td>需要比绑定的列</td>
结束语句,别忘记了
孟子E章 2010-08-13
  • 打赏
  • 举报
回复
Set MyRst = MyComm.Execute
While Not MyRst.EOF
Response.Write MyRst("字段名字")

MyRst.MoveNext
Wend
心灵的轻 2010-08-13
  • 打赏
  • 举报
回复
if not MyRst.eof then
Tjh_list = MyRst.getrows()
MyRst.Close()
Set MyRst = Nothing
set MyComm = nothing
for i=0 to ubound(Tjh_list,2)
Response.Write Tjh_list(1,i)
Response.Write Tjh_list(2,i)
next
end if
Set Tjh_list = Nothing

28,391

社区成员

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

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