Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



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

Posts: 27
Trades: 0
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
 
 
Register now for full access!
Old 04-01-2008, 06:16 PM Re: how to change sql statement in my script??? plz help
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.22648 seconds with 12 queries