1

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=23424324423432424 , 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"

skaffman
  • 398,947
  • 96
  • 818
  • 769
GethuJohn
  • 233
  • 2
  • 11
  • 23

2 Answers2

2

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
  • 71,481
  • 13
  • 158
  • 186
0

Because Int32 only support 10 digit value 0123456789, when we are trying more than 10 digit line string convert or initialize like 01234566789123456798

 int stratNo = Convert.ToInt31(Console.ReadLine()); \\less then 10 digit


 double stratNo = Convert.ToDouble(Console.ReadLine()); \\ more than 10 digit
sathish
  • 300
  • 3
  • 14