ASP, SQL server DB,Drop Down List

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nina2
    New Member
    • Jun 2007
    • 2

    ASP, SQL server DB,Drop Down List

    Hi,
    I'm creating a website for an hotel and i need to know how to collect data from a drop down list then search in the database and display it in another page. the design is like this:

    DropDownList1// view
    DropDownList 2// capacity
    DropDownList 3//price

    RadioGroup //type of data sort (Rooms are sorted by price or by room number)

    Button1


    what I want to do is when I click the button, I collect all the data that the user chose in all the controls (DropDownList1, DropDownList 2,DropDownList 3,RadioGroup) and start to search with them in the database, for example if the user chose the sea view and the capacity 2 persons and the price between 10$ and 20$ sorted by price, I will display all the rooms with a sea view and capacity 2 persons and a price between 10$ and 20$, sorted by price.

    please help,
    Thanks :)
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    hey, nina, welcome to the scripts developer network.

    how much do you have done so far? is your form and db already set up? Can you already connect to a db through asp? do you know how to write a db query?

    If you are just wondering about how to write the query, I would try something like this:[code=asp]query = "SELECT * FROM rooms WHERE view LIKE %"
    query = query & request("view") & "%"
    query = query & " AND capacity = " & request("capaci ty")
    query = query & " AND price BETWEEN " & request("price" )
    query = query & " ORDER BY " & request("sort")

    'print out query just to make sure it looks right
    response.write "<!-- " & query & " -->" & vbNewLine

    rs.open query, conn

    do until rs.eof
    'list each room and details
    'etc however you like
    rs.movenext
    loop[/code] let me know if this helps

    Jared

    Comment

    Working...