468,483 Members | 2,603 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

asp loop question

120 100+
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.

Expand|Select|Wrap|Line Numbers
  1. IF objRSYVRROUNDTRIPS("outbound_route") = "London Gatwick to Vancouver" THEN
  2.     Response.Write "<li><a href=""#LGWYVR"">London Gatwick</a></li>"
  3. End If
complete code
Expand|Select|Wrap|Line Numbers
  1. <%
  2. 'CHECK FOR PRICES
  3. DIM objYVRROUNDTRIPS
  4. Set objYVRROUNDTRIPS = Server.CreateObject("ADODB.Connection")
  5. objYVRROUNDTRIPS.ConnectionString = "Provider=SQLOLEDB;Data Source=hidden;" & _
  6. "Initial Catalog=Prices;User ID=hidden;Password=hidden"
  7. objYVRROUNDTRIPS.Open
  8.  
  9. DIM YVRROUNDTRIPS
  10. YVRROUNDTRIPS = "SELECT * FROM UK_Specials_Round_Trips WHERE outbound_route LIKE ('%to vancouver%')"
  11.  
  12. DIM objRSYVRROUNDTRIPS
  13. Set objRSYVRROUNDTRIPS = Server.CreateObject("ADODB.Recordset")
  14. objRSYVRROUNDTRIPS.Open YVRROUNDTRIPS, objYVRROUNDTRIPS
  15.  
  16. 'check to see if there are any prices
  17. If (NOT IsNull(objRSYVRROUNDTRIPS("Price"))) Then 
  18. Response.Write "<fieldset><legend>to <span class=""red"">Vancouver (YVR)</span> from</legend>"
  19. Response.Write "<table width=""100%"" align=""center"" cellpadding=""0"" cellspacing=""0"">"
  20. Response.Write "<tr><td><ul>"
  21.  
  22. IF objRSYVRROUNDTRIPS("outbound_route") = "London Gatwick to Vancouver" THEN
  23.     Response.Write "<li><a href=""#LGWYVR"">London Gatwick</a></li>"
  24. End If
  25.  
  26. Response.Write "</tr></table></fieldset>"
  27.  
  28. End If
  29.  
  30. objRSYVRROUNDTRIPS.Close
  31. Set objRSYVRROUNDTRIPS = Nothing
  32. objYVRROUNDTRIPS.Close
  33. Set objYVRROUNDTRIPS = Nothing
  34. %>
my sql query
Expand|Select|Wrap|Line Numbers
  1. 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.
Mar 24 '11 #1
1 1364
omar999
120 100+
will this code be of any use?

Expand|Select|Wrap|Line Numbers
  1. IF (objRSYVRROUNDTRIPS.Fields.Item("outbound_route").Value) & "London Gatwick to" THEN
  2.     Response.Write "test"
  3. End If    
  4.  
??
Mar 24 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

24 posts views Thread by Tweaxor | last post: by
14 posts views Thread by morpheus | last post: by
4 posts views Thread by bruce | last post: by
11 posts views Thread by logicode | last post: by
11 posts views Thread by SM | last post: by
2 posts views Thread by takayuki | last post: by
3 posts views Thread by troy_lee | last post: by
7 posts views Thread by gordon | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.