ADODB.Command访问存储过程如何得到返回值

mongmong 2002-09-28 12:22:22
SQL Server里有如下的存储过程

CREATE PROCEDURE [dbo].[Hello]
AS
select * from member

return 10
GO

现在使用ADO的ADODB.Command对象访问该存储过程,但是不知如何得到该过程的返回值(此处为10),那位大虾知道如何取得该值
...全文
45 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hycao 2002-10-12
  • 打赏
  • 举报
回复
Dim Sc As String, Result As String
Dim Cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Sc = "Driver={SQL Server}; Server=(local);Uid=sa;pwd=;database=Access_temp"
Cn.Open Sc
Set cmd.ActiveConnection = Cn
With cmd
.CommandType = adCmdStoredProc
.CommandText = "Hello"
End With
cmd(0).Direction = adParamReturnValue
cmd.Execute
Result = cmd(0)
MsgBox Result
Set Cn = Nothing
crystal_heart 2002-10-12
  • 打赏
  • 举报
回复
不知道,一般我是用OUT把返回值放到参数里边。
bill81 2002-10-12
  • 打赏
  • 举报
回复
delcae @str int
select * from member
exec @str output
mongmong 2002-09-28
  • 打赏
  • 举报
回复
送分了

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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