Soul Girl
2008-01-10 07:20:20 UTC
But when I execute the stored procedure with either a wrong username or a wrong password, it would still return a valid return (0).
I'm not very good in SQL.. So please help me out.. Thanks..
__________________________________
Create Proc spLoginUser
(@LoginUserId VarChar(10), @LoginUserPwd VarChar(20)= Null)
As
Begin
If Exists (Select LoginUserID From LoginUser)
Begin
SELECT LoginUserNo, LoginUserType
From LoginUser
Where LoginUserID = @LoginUserID and LoginUserPwd = @LoginUserPwd
IF @@Rowcount < 1
SELECT @LoginUserID = 0
End
Else
Return -102
If @@ERROR <> 0
Return -103
Return
Declare @NewId Int, @Status Int
Exec @Status = spLoginUser @LoginUserId='cusat01', @LoginUserPwd='pass'
Select @Status
If @status = 0
Select @NewID