Output Parameter Issue

fpendino

Registered User.
Local time
Yesterday, 18:05
Joined
Jun 6, 2001
Messages
73
Hi,
I have a stored proc which I'm using for a user login and it contains output parameters. I can not retreive the output paramters.

This is just a test retrieval but here is what I have.



DECLARE @curSession varchar(100)
DECLARE @ERR varchar(300)
DECLARE @DONE bit



exec spLoginUser 'TESTUser', 'TestPass', '00', '123', @ERR, @DONE, @CurSession

Select @curSession, @ERR, @DONE

The varibles are supposed to retrive the output parameters. They display NULL. I've tried setting the output parameters by using SELECT @OutputParam and SET @OutputParam..

I know it is assigning the value to all output parameters because when I do a select from within the spLoginsUser Stored Proc, it does output the correct info. Just not when I try to retrieve the parameters when calling from another stored proc(like above). I'm using SQL 2000 and here are bits of the SQL code from spLoginUser.


set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


ALTER PROCEDURE [dbo].[spLoginUser]
-- Add the parameters for the stored procedure here
(@UserName varchar(10),
@Password varchar(20),
@IPAddress varchar(20),
@SessionID varchar(100),
@ErrorString varchar(100) output,
@Success bit output,
@CurrentSession varchar(100) output
)

AS
BEGIN

SET NOCOUNT ON;

DECLARE @UserActive bit
DECLARE @WebApplicationUserID int
DECLARE @PasswordVerified bit
DECLARE @CurrentSessionID varchar(100)

--Check to see if user exists and is active.. Removed code for this

IF @UserActive = 1
BEGIN
IF @PasswordVerified = 1
BEGIN
SET @Success = 1
SET @CurrentSession = 'TEST1234'
END
END

SELECT @Success, @CurrentSession --This returns a set of the correct data

END


That is basically the idea of what I am doing, minus some of the bits of code..
 
Code:
DECLARE @curSession varchar(100)
DECLARE @ERR varchar(300)
DECLARE @DONE bit
 
 
 
exec spLoginUser 
'TESTUser', 
'TestPass', 
'00', 
'123', 
@ERR = @ERR OUTPUT, 
@DONE = @DONE OUTPUT, 
@CurSession = @CurSession OUTPUT
 
Select @curSession, @ERR, @DONE
 

Users who are viewing this thread

Back
Top Bottom