Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how do I retrive the output param value

Author  Topic 

PeterG
Posting Yak Master

156 Posts

Posted - 2004-01-16 : 17:59:39
If I have this stored proc, how do I retrieve the value of @outputparam in my asp page. I use the command object to pass the input param.

--ASP CODE --
With com
.ActiveConnection = con
.CommandType = 4
.CommandText = "dbo.SampleProc"

.Parameters(1) = icn
.Execute
End With

--STORED PROC --

Create PROCEDURE dbo.SampleProc
@inputparam int,
@outputparam varchar(20) OUTPUT

as

If @inputparam >= 0
begin
...
set @outputparam = 'yes'
end

else
begin
...
set @outputparam = 'no'
end

SamC
White Water Yakist

3467 Posts

Posted - 2004-01-16 : 18:14:49
Here's an example:


on error resume next
DIM cmdCourseStats
SET cmdCourseStats = Server.CreateObject("ADODB.Command")
WITH cmdCourseStats
.ActiveConnection = application("DBaddr")
.CommandText = "dbo.AD_CourseStats"
.CommandType = adcmdstoredproc
.Parameters.Append .CreateParameter ("RETURN_VALUE", adInteger, adParamReturnValue)
.Parameters.Append .CreateParameter ("@CallerAdminID", adInteger, adParamInput, , Session("AdminID"))
.Parameters.Append .CreateParameter ("@CourseID", adInteger, adParamInput, , Session("CourseID"))
.Parameters.Append .CreateParameter ("@BranchName", adVarchar, adParamOutput, 100)

.Execute ,,adExecuteNoRecords
SQLResult = err.description
ReturnValue = .Parameters("RETURN_VALUE")

str_Branchname = .Parameters("@Branchname")
End With
SET cmdCourseStats = Nothing
Go to Top of Page
   

- Advertisement -