sureshcd10 Posted December 5, 2005 Posted December 5, 2005 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 Quote ima
bri189a Posted December 5, 2005 Posted December 5, 2005 Don't pass a string...pass a binary value. The error is telling you what the exact problem is. Look up the CONVERT function in Sql Help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.