Solved

Classic ASP nesting inside of a loop

Posted on 2010-08-20
3
417 Views
Last Modified: 2012-06-27
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




0
Comment
Question by:swaggerking
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
mcv22 earned 250 total points
ID: 33488720
Try this:


SELECT DISTINCT Category FROM dbo.VacPckg
UNION
SELECT 'Europe' AS Catgory

Open in new window

0
 
LVL 12

Expert Comment

by:mcv22
ID: 33488723
Category ^typo
0
 

Author Closing Comment

by:swaggerking
ID: 33488865
It worked. Thanks!
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question