Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - How can I reverse the order of  db items displayed
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How can I reverse the order of db items displayed

 Post Reply Post Reply
Author
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Topic: How can I reverse the order of db items displayed
    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
 
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!
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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;"
Back to Top
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post 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;"
 
 
 
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post 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 - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post 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.
 
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.