|
Home > Archive > IIS ASP > March 2007 > Issue with Greater Than IF Statement
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Issue with Greater Than IF Statement
|
|
|
| When using the following statement, I am encountering a problem:
<% If rs.Fields(0) = "Lead 30 Day" THEN %>
<% IF rs.Fields(2) > "89" THEN %>
Pass
<% ELSE %>
FAIL
<% END IF%>
<% End If %>
rs.Fields(2) is a numerical value, in this case 100. For some reason,
the page is still displaying "Fail" for the record, even though 100 is
obviously larger than 89.
Any ideas on why it would think 100 is less than 89?
| |
|
| Since rs.Fields(2) is numeric you should rewrite the condition like:
If rs.Fields(2)>89 Then
"Nate" <nate.borland@westecnow.com> wrote in message
news:1175175926.154603.36740@n76g2000hsh.googlegroups.com...
> When using the following statement, I am encountering a problem:
>
> <% If rs.Fields(0) = "Lead 30 Day" THEN %>
> <% IF rs.Fields(2) > "89" THEN %>
> Pass
> <% ELSE %>
> FAIL
> <% END IF%>
> <% End If %>
>
> rs.Fields(2) is a numerical value, in this case 100. For some reason,
> the page is still displaying "Fail" for the record, even though 100 is
> obviously larger than 89.
>
> Any ideas on why it would think 100 is less than 89?
>
| |
| Evertjan. 2007-03-29, 1:23 pm |
| Nate wrote on 29 mrt 2007 in microsoft.public.inetserver.asp.general:
> When using the following statement, I am encountering a problem:
>
> <% If rs.Fields(0) = "Lead 30 Day" THEN %>
> <% IF rs.Fields(2) > "89" THEN %>
> Pass
> <% ELSE %>
> FAIL
> <% END IF%>
> <% End If %>
>
> rs.Fields(2) is a numerical value, in this case 100. For some reason,
> the page is still displaying "Fail" for the record, even though 100 is
> obviously larger than 89.
>
> Any ideas on why it would think 100 is less than 89?
>
"100" < "89"
because string:
"1" < "8"
because [ascii number values}:
49 < 56
[that is called string comparison]
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
|
|
|
|
|