469,917 Members | 1,977 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

Conditional Statement

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?
Jul 19 '05 #1
4 2000
Try

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

your HTML Code

<% end if %>

Rafael

"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:XM*********************@news-text.cableinet.net...
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?

Jul 19 '05 #2
"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:XM*********************@news-text.cableinet.net...
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 %>
Jul 19 '05 #3
"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:XM*********************@news-text.cableinet.net...
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.
Jul 19 '05 #4
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" <ba****@nojunkblueyonder.co.uk> wrote in message
news:XM*********************@news-text.cableinet.net...
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?

Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by in | last post: by
7 posts views Thread by Shaldaman | last post: by
4 posts views Thread by mux | last post: by
5 posts views Thread by paulo | last post: by
13 posts views Thread by Neal Becker | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.