Conditional Statement

A

Andrew Banks

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?
 
R

Rafael Nenninger

Try

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

your HTML Code

<% end if %>

Rafael
 
P

Phill. W

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.
 
C

Chris Hohmann

Andrew Banks said:
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 %>
 
A

Andrew Banks

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top