Issue with Greater Than IF Statement

Discussion in 'ASP General' started by Raj, Mar 29, 2007.

  1. Raj

    Raj Guest

    Since rs.Fields(2) is numeric you should rewrite the condition like:

    If rs.Fields(2)>89 Then

    "Nate" <> wrote in message
    news:...
    > 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?
    >
    Raj, Mar 29, 2007
    #1
    1. Advertising

  2. Raj

    Nate Guest

    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?
    Nate, Mar 29, 2007
    #2
    1. Advertising

  3. Raj

    Evertjan. Guest

    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)
    Evertjan., Mar 29, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. BobRoyAce
    Replies:
    7
    Views:
    451
    Peter Blum
    Mar 3, 2005
  2. danthman
    Replies:
    2
    Views:
    2,337
    danthman
    Dec 23, 2005
  3. Ryan
    Replies:
    1
    Views:
    504
  4. falcon
    Replies:
    10
    Views:
    18,569
    Roedy Green
    Feb 24, 2006
  5. Dwight Army of Champions
    Replies:
    4
    Views:
    2,712
    John H.
    Mar 17, 2010
Loading...

Share This Page