Link to home
Start Free TrialLog in
Avatar of swaggerking
swaggerkingFlag for United States of America

asked on

Classic ASP nesting inside of a loop

I have list of possible travel locations in my db table for vacation packages we offer. I'm using a SELECT DISTINCT (SELECT DISTINCT Category FROM dbo.VacPckg) to weed out duplicate location categories.

My Results as expected:
Asia
Canada
Caribbean
Hawaii
Pacific Northwest
etc....

Here is where I need help. I want add "Europe" into the above results in ABC order but "Europe" is not in the db table. Is it possible to add it inside of a loop/wend? Is there another method I should try?

Preferred Results:
Asia
Canada
Caribbean
EUROPE
Hawaii
Pacific Northwest



<!--#include virtual="/Connections/myConString.asp" -->

<%
Set strObj = Server.CreateObject ("ADODB.Command")
strObj.ActiveConnection = MYl_STRING
SQL = "SELECT DISTINCT Category FROM dbo.VacPckg" 
strObj.Prepared = true
strObj.CommandText =  sql
Set rsCategory = strObj.Execute
rsCategory_numRows = 0
%>

<ul>
<% while not rsCategory.EOF %>

<li><a href="vacpkg.asp?ref=<%=rsCategory(0)%>"><%=rsCategory(0)%></a></li>
<% rsCategory.MoveNext
wend %> 
        
</ul>

<%
rsCategory.Close()
Set rsCategory = Nothing
%>

Open in new window




ASKER CERTIFIED SOLUTION
Avatar of mcv22
mcv22
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Category ^typo
Avatar of swaggerking

ASKER

It worked. Thanks!