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

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

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

unit testing - How to mock PreferenceManager in Android? -