Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 1st, 2005, 11:20 AM
Authorized User
 
Join Date: Jan 2005
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default Order by more a requested variable

I need to be able to ORDER BY two different types of information

the first ORDER BY will be permanent and will never change. The second will be based upon a variable that is sent with the page. here is my sql statement...

orderby=request("orderby")

sql1 = "select preownedlistings.* from preownedlistings WHERE lactive=1 and listexpiredate > '"&date()&"' order by listingtype DESC,'" &orderby&"';"

The query seems to work fine and they are ordered by listingtype but not by the "orderby" variable, which in this case is a make of vehicle such as Honda, Ford...etc. they are still in random order not organized at all.

any suggestions?

 
Old March 1st, 2005, 11:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

take out the ' around orderby variable
 
Old March 1st, 2005, 11:33 AM
Authorized User
 
Join Date: Jan 2005
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks that worked...still having trouble trying to figure out when to use the single ' and when not to.

 
Old March 1st, 2005, 12:19 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You use single quote(s) for text (MS Access), varchar/char (SQL Server ) and datetime (SQL Server) variables.

SELECT field1,field2.. FROM MyTable WHERE Name = 'MyName'






Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL help requested mvoosten MySQL 4 March 18th, 2007 03:38 AM
Redirect to the requested page KamalRaturi ASP.NET 2.0 Professional 1 September 27th, 2006 04:32 AM
Requested registry access is not allowed hasanali00 BOOK: ASP.NET Website Programming Problem-Design-Solution 2 October 7th, 2005 08:53 AM
The webpage you requested is not available offline cathiec ASP.NET 1.0 and 1.1 Basics 0 October 6th, 2005 09:35 AM
Tool recommendation requested pankaj_daga Oracle 1 July 11th, 2004 09:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.