asp.net - How do I convert a string to an int type in C#? -


i taking string value textbox named txtlastappointmentno , want convert int , store in database using linq sql getting error "input string not in proper format".

my input string 2.

my code is:

      objnew.lastappointmentno=convert.toint32(txtlastappointmenno.text); 

please point out mistake.

assuming using webforms, need access textbox value , not textbox itself:

objnew.lastappointmentno = convert.toint32(txtlastappointmenno.text); 

or if referencing html control then:

objnew.lastappointmentno = convert.toint32(request["txtlastappointmenno"]); 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -