asp loop question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omar999
    New Member
    • Mar 2010
    • 120

    asp loop question

    hi guys

    i think i may have a syntax error but im not sure. im basically getting stuck where my if statement checks to see if column 'outbound_route ' contains 'London Gatwick to Vancouver' then print some html but no html is printing and im not getting any errors either.

    Code:
    IF objRSYVRROUNDTRIPS("outbound_route") = "London Gatwick to Vancouver" THEN
    	Response.Write "<li><a href=""#LGWYVR"">London Gatwick</a></li>"
    End If
    complete code
    Code:
    <%
    'CHECK FOR PRICES
    DIM objYVRROUNDTRIPS
    Set objYVRROUNDTRIPS = Server.CreateObject("ADODB.Connection")
    objYVRROUNDTRIPS.ConnectionString = "Provider=SQLOLEDB;Data Source=hidden;" & _
    "Initial Catalog=Prices;User ID=hidden;Password=hidden"
    objYVRROUNDTRIPS.Open
    
    DIM YVRROUNDTRIPS
    YVRROUNDTRIPS = "SELECT * FROM UK_Specials_Round_Trips WHERE outbound_route LIKE ('%to vancouver%')"
    
    DIM objRSYVRROUNDTRIPS
    Set objRSYVRROUNDTRIPS = Server.CreateObject("ADODB.Recordset")
    objRSYVRROUNDTRIPS.Open YVRROUNDTRIPS, objYVRROUNDTRIPS
    
    'check to see if there are any prices
    If (NOT IsNull(objRSYVRROUNDTRIPS("Price"))) Then 
    Response.Write "<fieldset><legend>to <span class=""red"">Vancouver (YVR)</span> from</legend>"
    Response.Write "<table width=""100%"" align=""center"" cellpadding=""0"" cellspacing=""0"">"
    Response.Write "<tr><td><ul>"
    
    IF objRSYVRROUNDTRIPS("outbound_route") = "London Gatwick to Vancouver" THEN
    	Response.Write "<li><a href=""#LGWYVR"">London Gatwick</a></li>"
    End If
    
    Response.Write "</tr></table></fieldset>"
    
    End If
    
    objRSYVRROUNDTRIPS.Close
    Set objRSYVRROUNDTRIPS = Nothing
    objYVRROUNDTRIPS.Close
    Set objYVRROUNDTRIPS = Nothing
    %>
    my sql query
    Code:
    SELECT * FROM UK_Specials_Round_Trips WHERE outbound_route LIKE ('%to vancouver%')
    outputs this
    ID PRICE OUTBOUND_ROUTE OUTBOUND_DATE INBOUND_ROUTE INBOUND_DATE
    7 318 Glasgow to Vancouver May 4 2011 Vancouver to Glasgow May 11 2011
    8 318 Glasgow to Vancouver May 11 2011 Vancouver to Glasgow May 18, Jun 08,15,22 2011
    9 598 Glasgow to Vancouver Jun 22 2011 Vancouver to Glasgow Jul 6 2011
    10 598 Glasgow to Vancouver Aug 10 2011 Vancouver to Glasgow Aug 17 2011
    11 318 Glasgow to Vancouver May 11 2011 Calgary to Glasgow May 18, 25, Jun 1, 8 2011
    22 318 London Gatwick to Vancouver Mar 24 2011 Vancouver to London Gatwick Mar 31 2011
    23 318 London Gatwick to Vancouver Mar 27 2011 Vancouver to London Gatwick Apr 3, 30, May 6 2011
    24 499 London Gatwick to Vancouver Mar 31, Apr 03 2011 Vancouver to London Gatwick Apr 3, 30, May 5, 6 2011
    25 318 London Gatwick to Vancouver Apr 30 2011 Vancouver to London Gatwick May 5, 6 2011
    26 318 London Gatwick to Vancouver Apr 28,30 May 6,8,10,12,13,15 2011 Vancouver to London Gatwick May 4, 5, 6, 8, 12, 13, 15, 17,19,20,22,27, 29 2011
    27 529 London Gatwick to Vancouver Aug 30 2011 Vancouver to London Gatwick Sep 06 2011
    69 398 Manchester to Vancouver May 6, 7 2011 Vancouver to Manchester May 13, 14 2011
    70 318 Manchester to Vancouver May 13, 14 2011 Vancouver to Manchester May 21 2011
    71 318 Manchester to Vancouver May 20 2011 Vancouver to Manchester May 27 2011


    please help

    thanks
    omar.
  • omar999
    New Member
    • Mar 2010
    • 120

    #2
    will this code be of any use?

    Code:
    IF (objRSYVRROUNDTRIPS.Fields.Item("outbound_route").Value) & "London Gatwick to" THEN
    	Response.Write "test"
    End If
    ??

    Comment

    Working...