B
Bob Barrows [MVP]
Jason said:I don't think you understand the problem. ASP defines 0 as false and
-1 as true, and everything else is neither.
No, not quite. If an expression evaluates to 0, it is False. All other
results are True*. Again, try:
<%
Response.Write CBool(-1)
Response.Write CBool(0)
Response.Write CBool(1)
Response.Write CBool(2)
%>
Here is the result I get from this:
TrueFalseTrueTrue
So you see that CBool(2) resulted in True. In fact, the only one that
resulted in False was 0.
In fact, try this:
<%
if (1+3) then
Response.Write "<br>true"
else
Response.Write "<br>false"
end if
s="abcd"
Response.Write "<BR>" & instr(s,"c")
if instr(s,"c") then
Response.Write "<BR>c is in abcd"
else
Response.Write "<BR>c is not in abcd"
end if
%>
This is the real reason both Yes/No values from Access and bit values
from SQL Server work well in vbscript/vb.
I'm still not clear about why your boolean values from MySQL aren't
working the same way.
Bob Barrows
*I realize I mistakenly said the reverse of this in my earlier message -
my apologies.