By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

asp loop question

100+
P: 120
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
Share this Question
Share on Google+
1 Reply


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