在VB中如何接收SQL存储过程的值!?

zlheadof 2003-07-08 09:35:05
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE login
@name char(16),
@pwd char(20),
@ret char(1) output
AS

set nocount on

if exists(select * from [user] where name = @name and pwd = @pwd)
begin
set @ret ="1"
end
else
set @ret="0"

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

...全文
53 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zlheadof 2003-07-09
  • 打赏
  • 举报
回复
如果我返回的是一个SQL语句呢!!

如果写存储过程,和VB的程序!!???
tollers 2003-07-08
  • 打赏
  • 举报
回复
另:.Parameters(0) 可以接收存储过程 return 的值
tollers 2003-07-08
  • 打赏
  • 举报
回复
第9行应该是
.Parameters(2) = "yyy"
阿建像熊猫 2003-07-08
  • 打赏
  • 举报
回复
sql="存储过程"
adoconn.execute sql

即可。
tollers 2003-07-08
  • 打赏
  • 举报
回复
Set cmdProc = New ADODB.Command

Set cmdProc.ActiveConnection = cnnDB
With cmdProc
.CommandType = adCmdStoredProc
.CommandText = strCmdText

.Parameters(1).Direction = adParamInput
.Parameters(1) = "xxx"
.Parameters(2).Direction = adParamInput
.Parameters(1) = "yyy"

.Parameters(3).Direction = adParamOutput
.Parameters(0).Direction = adParamReturnValue
.Execute
End With

返回值=.Parameters(3)
jameschan 2003-07-08
  • 打赏
  • 举报
回复
一般vb使用存储过程是adoconn.execute 存储过程 变量,变量。。这样的
具体忘了,呵呵,现在用mysql做服务器,还没有存储过程

1,217

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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