I have very strange problem with IsNumeric function in classic asp fail. Something like this happens in my code:
Response.write Score // 79.617
Response.write IsNumeric(Score) // false
Response.write IsNumeric("79.617") // true
Has anyone had an idea why this could happen?
In the specifications it is said that the functions works with strings that can be converted into numbers, and from the example above you can see i get “true” result. But what can then cause my issue?
This means
Scoreis simply not a string but rather something else, most likely coming from database.To be on the safe side, use your own function:
The
CStr()will make sure to convert anything except Null to a string, and to handle Null coming from database you have theIsNull()function.