I am passing query string and the url is as follows-> http://localhost:1086/Web/EditMobile.aspx?sno=2. But when i try to enter the url as follows,localhost:1086/Web/EditMobile.aspx?sno=2*3424324423432424* , i get the following error->Value was either too large or too small for an Int32. How do i handle this error. I must get an error report like " the value is not found in the table or database"
+1
A:
You're presumably using something like int.Parse
. Instead, use int.TryParse
, and if it returns false
, render the error message you actually want.
David M
2010-05-29 10:49:47
@ David: Yes David indeed I am using int.Parse. Let me trying out.
jithin
2010-05-29 10:55:19
@David: Yes David indeed I am using int.Parse. Let me try it out.
jithin
2010-05-29 11:03:37
You'll need to declare the `int` variable first, and pass it as an `out` parameter to the `TryParse` method.
David M
2010-05-29 11:19:52
@David: Thanks David.
jithin
2010-05-29 12:09:28