Click here to Skip to main content
15,886,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am tryieng to send textbox data to the table in date base its showing error like this plz help me..

Conversion failed when converting the varchar value 'System.Web.UI.WebControls.TextBox' to data type int.
Posted
Comments
ArunRajendra 24-Mar-14 8:04am    
Give your full code.

1 solution

Actually TextBox value are string by default (varchar for sql), and the column in database expects int value. So its throwing this error. YOu need to typecast this value to int.

C#
int a = like Convert.ToInt32(textbox1.Text)


than use this value to pass to database.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900