[thelist] Other ways to check for null
Mark Rees
mrees at itsagoodprice.com
Mon Nov 14 11:45:27 CST 2005
> if not isnull(rs("num_bedrooms")) or trim(rs("num_bedrooms")) <> "" then
> response.write("<b>Bedrooms:</b> " & rs("num_bedrooms") &
> "<br><br>"
> end if
>
The logic is wrong here.
You're basically saying (pseudocode):
if rs("num_bedrooms") is not null or "" then...
It can't be both those things, so it's always going to evaluate as true i.e.
if it's null, then it's not ""
You should be able to get away with a check for a zero length string to make
it simple.
But really, the question should be, why is num_bedrooms not an integer, and
so why aren't you checking to see if it is >0?
Hope this helps
Mark
More information about the thelist
mailing list