Reply
how to change sql statement in my script??? plz help
Old 04-01-2008, 02:41 PM how to change sql statement in my script??? plz help
Average Talker

Posts: 27
i have


<%


if request("direction") = "" or request("direction") = "asc" then
direction="asc"
direction_opp="desc"
else
direction="desc"
direction_opp="asc"
end if
sSQL = "select * from search "

'Restriction
if request("search") <> "" then
sSQL = sSQL & " where quote like '%" & replace(request("search"), "'", "''") & "%' or author like '%" & replace(request("search"), "'", "''") & "%'"
end if

'Order
if request("order") = "1" then
sSQL = sSQL & " order by id "&direction
end if

if request("order") = "2" then
sSQL = sSQL & " order by quote "&direction
end if

if request("order") = "3" then
sSQL = sSQL & " order by author "&direction
end if

open_recordset rs,sSQL%>

i have a databse name "search"

i fetch the database using this script. but i have putted buttons in my database fields. so every time this script fetches the database it fetches button script also...


now

i want to.....

when the user ckicks that buttoon i want to relod the same page but with the different sql statment

so that the database will chage......

how i can do this ????



or is there any other technique to do this other than fetching the button to change the database(sql statement) in the same page???????
__________________
me people say that I must be a horrible person, but that's not true. I have the heart of a young boy -- in a jar on my desk.
abhifrds2005 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 04-01-2008, 05:16 PM Re: how to change sql statement in my script??? plz help
Learning Newbie's Avatar
Moderator

Latest Blog Post:
What’s He Looking At?
Posts: 4,983
Name: John Alexander
You can either change the ASP code that writes the SQL code, or you can move the SQL code into your database as a stored procedure and not have the ugly mess to deal with. I'd opt for the second myself.
__________________
4 ways to improve the lives of the "bottom billion"

"HEY YOU KIDS GET OFF MY LAWN!" -John McCain
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to how to change sql statement in my script??? plz help
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12190 seconds with 13 queries