ASP and SQL

Associate
Joined
29 Dec 2004
Posts
159
Hi bit of a long question here i know but i wanted to make sure you had all the info, I am trying to send data to an SQL stored procedure and return a value to my asp page based on the results.

----------------------------------------------------------------------



@username varchar(12),
@password varchar(12),
@Return varchar(20) Output

AS

Select *
From tblUsers
Where Username Like @username AND Password Like @password

Select @Return = @@rowcount

Return @Return

----------------------------------------------------------------------

This should return 1 if the username and pass are correct and 0 if incorrect if i understand it correctly.

----------------------------------------------------------------------
ASP Code

paramOutput = cmdStoredProc.CreateParameter("@Return", adchar, adParamOutput, 20, "")
cmdStoredProc.Parameters.Append(paramOutput)
Response.Write(cmdStoredProc.Parameters("@Return").Value)

This is the asp code im using to create, pass and retrieve the variable

When i run the SP on the server it executes perfectly and gives me 1 when i use the correct details and 0 when i dont, but when i do the same from asp it returns 0 all the time. sorry for the long post but any help is appreciated
 
Back
Top Bottom