Conditional Statement

Discussion in 'ASP General' started by Andrew Banks, Nov 14, 2003.

  1. Andrew Banks

    Andrew Banks Guest

    I've got the following VB in an ASP page and can't see why it won't work

    <% if Request.QueryString(Failed=="N")%> The Failed variable is N <% else
    %>The failed variable is not N<% end if %>

    I'm calling the page as thepage.asp?Failed=N

    Any one?
     
    Andrew Banks, Nov 14, 2003
    #1
    1. Advertising

  2. Try

    <% if Request.QueryString("Failed")="N" then %>

    your HTML Code

    <% end if %>

    Rafael

    "Andrew Banks" <> wrote in message
    news:XM8tb.4085$...
    > I've got the following VB in an ASP page and can't see why it won't work
    >
    > <% if Request.QueryString(Failed=="N")%> The Failed variable is N <% else
    > %>The failed variable is not N<% end if %>
    >
    > I'm calling the page as thepage.asp?Failed=N
    >
    > Any one?
    >
    >
     
    Rafael Nenninger, Nov 14, 2003
    #2
    1. Advertising

  3. Andrew Banks

    Phill. W Guest

    "Andrew Banks" <> wrote in message
    news:XM8tb.4085$...
    Andrew,

    <% if Request.QueryString(Failed=="N")%>

    Three things wrong here.
    1. VB requires the Then keyword at the end of the condition,
    2. Request.QueryString is a Collection, so you need to extract the
    item you want either by index (number) or name, and
    3. VB doesn't use "==" for its equality test [yet].

    <%
    If Request.QueryString( "Failed" ) = "N" Then
    Response.Write "The Failed variable is N"
    Else
    Response.Write "The failed variable is not N"
    End If
    %>

    HTH,
    Phill W.
     
    Phill. W, Nov 14, 2003
    #3
  4. "Andrew Banks" <> wrote in message
    news:XM8tb.4085$...
    > I've got the following VB in an ASP page and can't see why it won't

    work
    >
    > <% if Request.QueryString(Failed=="N")%> The Failed variable is N <%

    else
    > %>The failed variable is not N<% end if %>
    >
    > I'm calling the page as thepage.asp?Failed=N
    >
    > Any one?


    <% If Request.QueryString("Failed") = "N" Then %>
    The Failed variable is N
    <% Else %>
    The Failed variable is not N
    <% End If %>
     
    Chris Hohmann, Nov 14, 2003
    #4
  5. Andrew Banks

    Andrew Banks Guest

    Thanks all, much apreciated

    I'm usually a PHP guy and dabble with a bit of C#.NET - I just have to
    complete this one task in ASP VB


    "Andrew Banks" <> wrote in message
    news:XM8tb.4085$...
    > I've got the following VB in an ASP page and can't see why it won't work
    >
    > <% if Request.QueryString(Failed=="N")%> The Failed variable is N <% else
    > %>The failed variable is not N<% end if %>
    >
    > I'm calling the page as thepage.asp?Failed=N
    >
    > Any one?
    >
    >
     
    Andrew Banks, Nov 14, 2003
    #5
    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. Anand P Paralkar
    Replies:
    2
    Views:
    9,511
    Srinivasan Venkataramanan
    Aug 4, 2003
  2. Erica
    Replies:
    3
    Views:
    1,348
    The Dead Bishop
    Jul 18, 2004
  3. Replies:
    3
    Views:
    823
  4. Giorgio
    Replies:
    1
    Views:
    3,090
    Eliyahu Goldin
    Jul 21, 2005
  5. Alec S.
    Replies:
    10
    Views:
    10,271
    Alec S.
    Apr 16, 2005
Loading...

Share This Page