Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Pittsburgh, PA
    Thanked 0 Times in 0 Posts

    Question how do I pass a query into a SQL statement?

    So I have a table with 3000 entries, containing 0000- 2999, in one column. I wrote 60 queries returning ranges of 50 rows (0000-0049, 1550-1599...). The other variables which are used are being passed into asp from a form, so the query should be passed through from the same form as well- perhaps as radio options?

    I want the SQL statement to look like this:

    Set DB = Connect()
    SQL = "SELECT fol_List FROM *"
    Set RS = DB.Execute (SQL)

    Where the * is replaced by the radio option.

    Can this be done- and if so- how?

    Thank you for any assistance .


  • #2
    Regular Coder
    Join Date
    Mar 2007
    Thanked 19 Times in 19 Posts
    SQL = "SELECT fol_List FROM " & request.form("your_radio_button")

    That's all it takes.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #3
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Near Chicago, IL, USA
    Thanked 32 Times in 31 Posts
    Be sure to strip possible malicious characters from the input (on the server side), as it's pretty easy to script attack this sort of thing.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts