Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want to pass value in txtPassword.Text to to @Pwd varBinary(50) in SqlServer200 variable in a stored procedure.

 

Vb.net code I am using is as follows

 

 'Resets the existing password with the new password
       Dim n As Integer
       sqlCmd = New SqlCommand("usp_SavePassword", conUserAccess)
       sqlCmd.CommandType = CommandType.StoredProcedure
       sqlCmd.Parameters.Add("@UserId", txtUserId.Text)
       sqlCmd.Parameters.Add("@Pwd", txtConfirmPassword.Text)
       If (txtConfirmPassword.Text = String.Empty) Then

       End If

       OpenConnection()
       sqlCmd.ExecuteNonQuery()
       ResetMessage()
       lblMessage.Text = "Your password has updated with the new password"
      

 

My stored procedure is as follows

 

CREATE PROCEDURE usp_SavePassword
(
@UserId USERID,
@Pwd varBinary(50)
)
AS
set nocount on
begin

update  IBUSER
set  PASSWORDBIN = @Pwd
where PKUSERID = @UserId 
-- Error check
if @@ERROR <> 0
 Return(-1)
else
 Return
end

GO

 

I am getting the following error message

 

Implicit conversion from data type nvarchar to varbinary is not allowed. Use the CONVERT function to run this query.

 

How can I solve this problem ? Plzz help me

ima

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...