OutFront Forums
     Home    Register     Search      Help      Login    

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

Sponsors
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

 

Order By Issue

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Order By Issue
Page: [1]
 
Mav44

 

Posts: 197
Joined: 6/25/2006
Status: offline

 
Order By Issue - 10/3/2009 15:19:27   
I hate to keep comingback to the well but I am so close to the end of this project I can smell it.

My code is running great but when I put a variable statement in for the "order by" it returns "constant expression was encountered in the ORDER BY list, position 1"

The code that I am using is

sa = request.form("sa")
searchstr = request.form("searchstr") 
searchstr1 = request.form("searchstr1") 
searchstr2 = request.form("searchstr2") 
searchstr3 = request.form("searchstr3") 

sql = "select * from db23 where b_distributor like '%" & searchstr & "%' and a_region like '%" & searchstr1 & "%' and q_status like '%" & searchstr2 & "%' order by '%" & searchstr3 & "%' DESC"

BeTheBall

 

Posts: 6493
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Order By Issue - 10/3/2009 23:14:44   
I don't believe you need the single quotes in the ORDER BY statement. Try changing:

'%" & searchstr3 & "%'

to simply:

%" & searchstr3 & "%

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to Mav44)
Mav44

 

Posts: 197
Joined: 6/25/2006
Status: offline

 
RE: Order By Issue - 10/3/2009 23:32:27   

Thanks for taking a look. I removed the single quotes and posted my page and got:


Microsoft OLE DB Provider for SQL Server error '80040e14'
Incorrect syntax near 'i_value'.


i_value is what was supposed to be submitted for "searchstr3" and what I want to sort by so at least I know it is pulling the correct value

(in reply to BeTheBall)
BeTheBall

 

Posts: 6493
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Order By Issue - 10/4/2009 9:58:47   
Sorry. I missed the forest for the trees. You also would not need the % symbols as those are wildcard symbols used in a LIKE query. So, now change:

%" & searchstr3 & "%

to:

" & searchstr3 & "

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to Mav44)
Mav44

 

Posts: 197
Joined: 6/25/2006
Status: offline

 
RE: Order By Issue - 10/4/2009 12:31:43   
Perfect you nailed it Duane! Works great now!

(in reply to BeTheBall)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Order By Issue
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts