Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 28th, 2005, 02:58 AM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default If Else

I am trying to change the heading in a table if a criteria is met like so

<table width="100%" align="center" border="4" cellspacing="0" cellpadding="2">
  <tr>
    <th>BR #</th>
 <%IF objPagingRS.Fields(1) <> O7 THEN %>
    Class is <%= objPagingRS.Fields(1) %>
    <th>LNER<br />
      No.</th>
    <th>1946 #</th>
    <th>Pre-<br />
      Group</th>

 <% ELSE %>
    <th>WD 7xxxx<br />
      No.</th>
    <th>BR WD</th>

  <% END IF %>
Blah Blah

My prob is although "Class is <%= objPagingRS.Fields(1) %>" returns O7 when I select those records from the database the If statement appears to have no result as if O7 had not been selected, ???

Can anyone help please

(!]
 
Old April 28th, 2005, 03:42 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

It looks like you code is treating O7 like a variable rather than a string, try <> "O7".

HTH,

Chris

 
Old April 28th, 2005, 10:29 PM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Many thanks, you got it in one.

I really should have worked it out myself (sigh)

Roy
:)









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.