We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Error on Parameter

Medium Priority
252 Views
Last Modified: 2012-05-06
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
Comment
Watch Question

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.

Author

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
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
OK...checking...give me a few...thx

Author

Commented:
Thx Brandon...rockin as expected :-)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.