|
| |
|
|
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.
|
|
|
|
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
|
|
|
|
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.
|
|
|
|
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!
|
|
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
|
|
|