又是存储过程问题 !

CheerYang 2005-05-17 04:42:33
存府过程如下:
------------------------------
create produce test
as
select * from table
go

------------------------------

asp调用
--------------------------------
<!--#include file="../include/conn.asp"-->
<!--#include file="../include/adovbs.inc"-->
<%
Rs=Server.CreateObject("ADODB.Recordset")
Set Rs=Conn.execute("Exec sp_name")
'这里如何输出select * from table的所有记录集呀?
%>
...全文
104 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
cheng17 2005-05-18
  • 打赏
  • 举报
回复
<!--#include file="../include/conn.asp"-->
<!--#include file="../include/adovbs.inc"-->
<%
Rs=Server.CreateObject("ADODB.Recordset")
Set Rs=Conn.execute("Exec sp_name")
'这里如何输出select * from table的所有记录集呀?
response.write rs(0)
%>

devilzone 2005-05-18
  • 打赏
  • 举报
回复
存储过程中使用游标
cqhunter 2005-05-17
  • 打赏
  • 举报
回复
查询分析器里,存储过程中输出参数这样使用:
declare @id int
exec sp(存储过程) @id output
select @id
上面的用法是假设sp中有一个输出参数。
brotherq 2005-05-17
  • 打赏
  • 举报
回复
输出不同吧,存储过程只涉及对数据库的操作,它不会显示到客户端的屏幕上来的。
chjpeng 2005-05-17
  • 打赏
  • 举报
回复
执行存储过程获取和数据集与直接执行rs.open conn,sql,..输出是一样的
pringlesgirl 2005-05-17
  • 打赏
  • 举报
回复
不好意思,刚才手快,没有修改,直接copy自己的代码,supplier就是RS;p
 
 其实我比较疑惑的是,在sql里面如何取出!

 记得要传值,我在查询分析器不知道如何取出用,按run后结果显示为一个我select的变量,可惜我就是取不出来哦
pringlesgirl 2005-05-17
  • 打赏
  • 举报
回复
能说明白点吗?
我的意思是说,简单的select * from table语句,想输出记录集(所有字段),难道全部都要在存储过程中写output参数吗?
----不用!
set Rs=Server.CreateObject("ADODB.Recordset")
Set Rs=Conn.execute("Exec test")
if not Rs.EOF then
Response.Write supplier("fieldName1") & chr(12) & supplier("fieldName2")
end if


kingcrab 2005-05-17
  • 打赏
  • 举报
回复
你平常怎样使用这Rs个东西的,现在还这么用就可以了。
devilzone 2005-05-17
  • 打赏
  • 举报
回复
Set Rs=Conn.execute("select * from table")

Set Rs=Conn.execute("Exec test")

效果一样
CheerYang 2005-05-17
  • 打赏
  • 举报
回复
能说明白点吗?
我的意思是说,简单的select * from table语句,想输出记录集(所有字段),难道全部都要在存储过程中写output参数吗?
devilzone 2005-05-17
  • 打赏
  • 举报
回复
Set Rs=Conn.execute("select * from table") 可以什么样输出

Set Rs=Conn.execute("Exec test") 就可以什么样输出
CheerYang 2005-05-17
  • 打赏
  • 举报
回复
Set Rs=Conn.execute("Exec sp_name")
不好意思,以上应改为
Set Rs=Conn.execute("Exec test")

28,406

社区成员

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

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