asp调用sql存储过程为什么用不起输出参数和返回值?

dorealprger 2003-05-31 02:06:06
在调用SQL存储过程做好的输出参数没有任何值?
返回值也是一样,只有将转化为返回记录集才行?
为什么?好学得好郁闷哦。
set conn=server.createobject("adodb.connection")
set record=server.createobject("adodb.recordset")
set command1=server.createobject("adodb.command")
conn.open "dsn=test;uid=sa;pwd=123;database=test;"
command1.activeconnection=conn
command1.commandtype=4
command1.commandtext="c"
command1.parameters.append command1.createparameter("a",adinteger,adparamoutput,30)
'record.open command1.execute() /*记录集方式可以*/
'response.Write(record("test")
a=command1("a")
response.Write(a)

****************************
ALTER proc c
@a varchar(30) output
as
set @a='This is the test!'
select @a as 'test' /*记录集方式可以*/
*****************************
...全文
52 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
love89 2003-05-31
  • 打赏
  • 举报
回复
关注,我也是刚学存储过程的.
dorealprger 2003-05-31
  • 打赏
  • 举报
回复
多谢,多谢,散分。哈哈哈
forestyang 2003-05-31
  • 打赏
  • 举报
回复
adinteger 能有30这么长吗?这里
command1.parameters.append command1.createparameter("a",adinteger,adparamoutput,30)
应该是
command1.parameters.append command1.createparameter("a",adVarchar,adparamoutput,30)

dorealprger 2003-05-31
  • 打赏
  • 举报
回复
不要意思少了一句执行,还是不行呢?
forestyang 2003-05-31
  • 打赏
  • 举报
回复
上面你先
command1.execute

a=command1("a")
forestyang 2003-05-31
  • 打赏
  • 举报
回复
总要这个存储过程执行了才有输出值或者返回值的
andy2001p 2003-05-31
  • 打赏
  • 举报
回复
关注中。。。

28,390

社区成员

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

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