asp.net - Check Integer Value on Asmx -
i have sample web method on services,
<webmethod()> _ public function addthis(byval x integer, byval y integer) integer dim mysum integer if not isnumeric(x) return 0 end if mysum = x + y return mysum end function
when debug it, suddnely made mistake x or y value , , give me error :
system.argumentexception: cannot convert gf system.int32. parameter name: type ---> system.formatexception: input string not in correct format.
i try check value :
if not isnumeric(x) return 0 end if
but keep getting error, possible check value first before run services?
at point check "isnumeric(x)", x numeric. expect integer parameters, error occur moment call function addthis.
you have check x , y before calling function. or if not possible, use this:
public function addthis(byval x string, byval y string) integer dim mysum integer if not isnumeric(x) or not isnumeric(y) return 0 end if mysum = integer.parse(x) + integer.parse(y) return mysum end function
Comments
Post a Comment