asp tutorials, asp.net tutorials, sample code, and Microsoft news from 15Seconds
Data Access  |   Troubleshooting  |   Security  |   Performance  |   ADSI  |   Upload  |   Email  |   Control Building  |   Component Building  |   Forms  |   XML  |   Web Services  |   ASP.NET  |   .NET Features  |   .NET 2.0  |   App Development  |   App Architecture  |   IIS  |   Wireless
 
Pioneering Active Server
 Power Search








Active News
15 Seconds Weekly Newsletter
• Complete Coverage
• Site Updates
• Upcoming Features

More Free Newsletters
Reference
News
Articles
Code Samples
Components
Tools
New
Free
Downloads
Vendors
FAQ
Feedback
Books
Links
DL Archives
Community
Messageboard
List Servers
Mailing List
WebHosts
Consultants
Tech Jobs
15 Seconds
Home
Site Map
Press
Legal
Privacy Policy
internet.commerce














internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

HardwareCentral
Compare products, prices, and stores at Hardware Central!

I recently found, while using ADO in ASP to query an Access Database, that passing request variables in the Order By clause of a SQL statement is slightly different than the WHERE clause. To pass the Order By variable along with an ASC or DESC variable, you would use the following syntax:
'This code assumes you have made your database connection.
'the following select clause uses a value from a form
'for the order by criteria and also a form value for ASC or DESC.
'You can replace the LIKE word with "=" if needed.

SQLQuery = "SELECT * FROM pcrdet WHERE PCRDescription LIKE '%" & Trim(request.form("SearchText")) & "%' ORDER BY "& request.form("SortBy") &" "& request.form("buttonSortBy")

It easy to confuse yourself by placing single and double quotes around the complete clause. Doing that will produce errors.

Submitted by Bruce Strickland



email this code sample to a colleague

Related Products
FileSystemObject
The FileSystemObject group is a set of COM objects that allow you to manipulate the file system on from an Active Server Page. FileSystemObject which is documented here is the version that comes with IIS 4.0. Which is much different then the limited version which shipped with IIS 3.0. The set of COM objects which consist of the FileSystemObject software are all free and cover almost every feature needed.
[Top]

Support the Active Server Industry



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers