Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Classic ASP nesting inside of a loop

Posted on 2010-08-20
3
Medium Priority
?
420 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 1000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

721 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