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
Post a Comment