Help with Array (I think this is what I need)

S

Simon

Hi All.

I have a page publlished @ http://www.shopbcn.com/directory.asp

On this page you will see a left navigation listing shops. The database also
has a category for Restaurants

Currently the left nav does a simple rs loop through the category in ID ASC
order as below


OpenDB()

sql="SELECT * FROM tblDirCats ORDER BY DirCatID ASC"
Set rsDirCats = Server.CreateObject("ADODB.Recordset")
rsDirCats.Open sql, oConn, 1, 1

Do while not rsDirCats.EOF

< html/asp which retrieved populated sub cats snipped >

rsDirCats.MoveNext
Loop

rsDirCats.Close
Set rsDirCats=nothing

CloseDB()

As new Categories are added to the database, I need to always list
Restaurants (DirCatID=75) as the final category.

I could do this using a simple if not DirCatID=75 in the rs loop and then
using another connection to go back and get the Restaurants, but I'm sure
there must be a more efficient way of doing this.

Thanks for any help in advance.

Simon
 
R

Ray Costanzo [MVP]

Try:

"SELECT * FROM tblDirCats ORDER BY DirCatID<>75,DirCatID ASC"

For the quick and dirty fix.

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top