NIK VYAVAHARE

NIK VYAVAHARE

  • 1.5k
  • 115
  • 4.5k

Input string was not in correct format

Sep 3 2015 5:01 AM
I'm Using visual studio 10 and sql server 8, i get the error like "INPUT STRING WAS NOT IN CORRECT FORMAT"
My code of stored procedure is-:
 
ALTER PROCEDURE tester_changePassword_sp_2
@User_ID numeric(18, 0),
@Password varchar(50)
AS
BEGIN
SET NOCOUNT ON;
update [dbo].User_Master set Password=@Password where User_ID=@User_ID
END
 
and code for c# page is:-
 
 
using (SqlConnection con = Class1.getconnection())
{
SqlCommand cmd = new SqlCommand("tester_changePassword_sp_2", con);
cmd.CommandType = CommandType.StoredProcedure;
id = "Select User_ID from User_Master where User_Name=t5";
cmd.Parameters.Add("@User_ID", SqlDbType.Int).Value = id;
cmd.Parameters.Add("@Password", SqlDbType.VarChar).Value = Convert.ToString(txt_confirm_password.Text);
cmd.ExecuteNonQuery();
}
 and i have declared id as a string.
 
so can i get where i'm wrong.. 
 
 

Answers (5)