• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

Error on Parameter

Getting an error on this code:  any help is apprciated...thx

> Procedure or function 'usp_CheckPWDate' expects parameter '@User_Password',
> which was not supplied.

ALTER PROCEDURE [dbo].[usp_CheckUserLoginPW]
@User_Login varchar(50),
@User_Password varchar (50),
@RetStatus tinyint output
as
set nocount on
declare @PW varchar(50)
select @pw= user_password from tbl_user
where user_login=@user_login
if @@rowcount=0
   set @retstatus=0
else if @user_password = @pw
begin
exec usp_CheckPWDate @User_Login = @user_login
     ,@RetStatus =@RetStatus output
 
if @RetStatus = 0 /*from password date check*/
   set @retstatus=1  -- login OK, password date ok
else if @retStatus = 1 /*from password date check*/
   set @retstatus=3  -- password is ABOUT to expire
else if @retStatus = 2 /*from password date check*/
   set @retstatus=4  -- password "IS" expired
end
else
   set @retstatus=2
0
Glen_D
Asked:
Glen_D
  • 3
  • 2
1 Solution
 
BrandonGalderisiCommented:
In your call to usp_CheckPWDate:

exec usp_CheckPWDate @User_Login = @user_login
     ,@RetStatus =@RetStatus output

You aren't passing @user_password.  Remember we changed this so that the password was checked for validity in THIS procedure (usp_checkuserloginpw).  Post usp_checkpwdate and we'll remove the @user_password dependency as it is no longer needed.
0
 
Glen_DAuthor Commented:
ALTER PROCEDURE [dbo].[usp_CheckPWDate]
@User_Login varchar(50),
@User_Password varchar (50),
@RetStatus tinyint output
 
as
 
set nocount on
 
declare @password_date datetime
declare @password_check int
declare @userID int
 
select @password_date =  Date_PW_Change from tbl_User
where user_login=@user_login and userID = @UserID
 
Set @password_check = DATEDIFF(day, @password_Date, getdate())
 
if @password_check < 84
   set @retstatus=0
else if @password_check between 85 and 90
   set @retstatus=1
else
   set @retstatus=2
0
 
BrandonGalderisiCommented:
Ok.  It wasn't actually being used so I just removed the parameter.
ALTER PROCEDURE [dbo].[usp_CheckPWDate]
@User_Login varchar(50),
@RetStatus tinyint output
 
as
 
set nocount on
 
declare @password_date datetime
declare @password_check int
declare @userID int
 
select @password_date =  Date_PW_Change from tbl_User
where user_login=@user_login and userID = @UserID
 
Set @password_check = DATEDIFF(day, @password_Date, getdate())
 
if @password_check < 84
   set @retstatus=0
else if @password_check between 85 and 90
   set @retstatus=1
else
   set @retstatus=2

Open in new window

0
 
Glen_DAuthor Commented:
OK...checking...give me a few...thx
0
 
Glen_DAuthor Commented:
Thx Brandon...rockin as expected :-)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now