PDA

View Full Version : why is isNumeric returning false??


Spudhead
09-15-2008, 01:47 PM
This is just WEIRD. Or I'm stupid. The exact same code - the same include file - works on every other page, but on this...

I get some data out of a mySQL database, and chuck it into an array with GetRows().

response.write isNumeric(aListSize(0,0))

produces "false"

but

response.write "*" & aListSize(0,0) & "<br/>"

produces

*3<br/>


WTF??? Since when is 3 not a number? And this is happening with EVERY numeric value I'm getting out of the database and dumping into an array. But I do all that with a bunch of code libraries in include files - there is literally no difference between the code that does that on all the other pages on the site - which work - and this page, which doesn't.

The SQL isn't doing anything to it. I'm just doing a SELECT COUNT(*).

I just don't get it. If it doesn't think "3", or "14", are numeric, what does it think they are?

Brandoe85
09-15-2008, 03:50 PM
Weird, maybe try using CInt() within isNumeric(); also, what does vartype(aListSize) give? Seems obvious but something isn't happening as expected.

Good luck;

Spudhead
09-15-2008, 04:11 PM
It's returning 14 for the vartype. I have no idea why it thinks it's a decimal - it's clearly an integer, it's an integer field in the database... unless mySQL's COUNT() function returns decimals when it's counting integers? I've never seen it do that before, mind.

CInt() is working for now, but I'm still worried. An application that doesn't recognise numbers isn't going to live for very long out of beta...