Print Page | Close Window

How can I reverse the order of db items displayed

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=27040
Printed Date: 29 March 2026 at 2:48am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: How can I reverse the order of db items displayed
Posted By: kennywhite
Subject: How can I reverse the order of db items displayed
Date Posted: 26 February 2009 at 7:42pm
Hello,
 
As my first learning experience with ASP I used this tutorial: http://www.webwiz.net/kb/asp_tutorials/connecting_to_a_database.asp" rel="no follow - http://www.webwiz.net/kb/asp_tutorials/connecting_to_a_database.asp
 
I created the database, html and ASP pages. Everything works great, but I would like to know how I can display guest book entries newest to oldest based on the entry's ID#. I'm sure that this can be done in a very simple way, I just don't know it.
 
Thanks!



Replies:
Posted By: WebWiz-Bruce
Date Posted: 27 February 2009 at 9:13am
You would add the following to the SQL:-

strSQL = "SELECT tblComments.Name, tblComments.Comments FROM tblComments" & _
"ORDER BY tblComments.ID_no DESC;"


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: kennywhite
Date Posted: 27 February 2009 at 4:38pm
I can't seem to get that to work.
 
I changed the original line to the above and now I get this error:
 
Error Type:
Microsoft VBScript compilation (0x800A0408)
Invalid character
/guestbook/guestbook.asp, line 30, column 78
strSQL = "SELECT tblComments.Name, tblComments.Comments FROM tblComments" & _ "ORDER BY tblComments.ID_no DESC;"
 
 
 


Posted By: Scotty32
Date Posted: 27 February 2009 at 4:41pm
Make sure that they are on different lines, if not add a return after the _

or use this (all on one line):

strSQL = "SELECT tblComments.Name, tblComments.Comments FROM tblComments ORDER BY tblComments.ID_no DESC;"





-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .


Posted By: kennywhite
Date Posted: 27 February 2009 at 6:02pm
Originally posted by Scotty32 Scotty32 wrote:

Make sure that they are on different lines, if not add a return after the _

or use this (all on one line):

strSQL = "SELECT tblComments.Name, tblComments.Comments FROM tblComments ORDER BY tblComments.ID_no DESC;"



 
Thanks, this worked. I guess I must have entered the the first example in wrong.
 
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net