有人可以解释一下参数 RETURN_VALUE 吗?
我想知道 RETURN_VALUE 是什么意思!我被这件事困住了。如何在 SQL Server 存储过程中使用 RETURN_VALUE?谢谢..
ASP:
Set cmdDB = Server.CreateObject("ADODB.Command")
With cmdDB
.ActiveConnection = ADOConM
.CommandText = "usp_jaljava_member_select"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, 0)
.Parameters.Append .CreateParameter("@TLoginName", adVarChar, adParamInput, 15, lcase(TLoginName))
.Parameters.Append .CreateParameter("@TPassword", adVarChar, adParamInput, 20, TPassword)
.Parameters.Append .CreateParameter("@retval", adVarChar, adParamOutput, 50)
' .Parameters.Append .CreateParameter("@TPinCode", adVarChar, adParamInput, 15,TPinCode) .Execute,,adExecuteNoRecords
RetVal = .Parameters("@retval")
Ret = Trim(.Parameters("RETURN_VALUE"))
'Set .ActiveConnection = Nothing
End With
Set cmdDB = Nothing
UTid = RetVal
SQL Server 存储过程:
CREATE PROCEDURE usp_jaljava_member_select
@TLoginName varchar(15),
@TPassword varchar(20),
@retval varchar(50) OUTPUT
--@TPinCode varchar(15)
AS
I want to know what does RETURN_VALUE mean! I'm stuck at this thing. How to use RETURN_VALUE in a SQL Server stored procedure? thanks..
ASP:
Set cmdDB = Server.CreateObject("ADODB.Command")
With cmdDB
.ActiveConnection = ADOConM
.CommandText = "usp_jaljava_member_select"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, 0)
.Parameters.Append .CreateParameter("@TLoginName", adVarChar, adParamInput, 15, lcase(TLoginName))
.Parameters.Append .CreateParameter("@TPassword", adVarChar, adParamInput, 20, TPassword)
.Parameters.Append .CreateParameter("@retval", adVarChar, adParamOutput, 50)
' .Parameters.Append .CreateParameter("@TPinCode", adVarChar, adParamInput, 15,TPinCode)
.Execute,,adExecuteNoRecords
RetVal = .Parameters("@retval")
Ret = Trim(.Parameters("RETURN_VALUE"))
'Set .ActiveConnection = Nothing
End With
Set cmdDB = Nothing
UTid = RetVal
SQL Server stored procedure:
CREATE PROCEDURE usp_jaljava_member_select
@TLoginName varchar(15),
@TPassword varchar(20),
@retval varchar(50) OUTPUT
--@TPinCode varchar(15)
AS
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MS SQL 存储过程可以返回
返回值
- 这与输出参数不同。上面的代码使您可以访问此返回值。
有关详细信息,请参阅 MSDN (RETURN (Transact-SQL))。
因此,对于以下存储过程:
以下代码会将
Ret
设置为 1 或 2,具体取决于传入的参数和数据:A MS SQL stored procedure can return a
return value
- this is apart from output parameters.The code above gives you access to this return value.
See MSDN for more information (RETURN (Transact-SQL)).
So, for the following stored procedure:
The following code would set
Ret
to 1 or 2, depending on the passed in parameter and data:这是将从存储过程返回的值。
来自使用带有输出参数的存储过程
从链接
This is the value that would be returned from the Stored procedure.
From Using a Stored Procedure with Output Parameters
From the link
我认为,返回值的参数名称可以是任何东西。
如果你的存储过程返回一个值,它可以写成
I think, the parameter name for return value could be anything.
If your stored procedure returns a value, it could be written as