0

I am implementing an online parking reservation system and I need to bind a table with 2 Controls.

for example the user selects a Reservation start date and the parking location from a RadioButtonList and then a button (Search Availability) is pushed to fetch the parking from the database according to the Date selected and Location.

the question is: How can I bind the (Reservation Start Date Control) with (RadioButtonList) to both search in the database? and what would be the Sql Query?

Regards.

1 Answer 1

1

This is pretty basic stuff so you've got a lot of work ahead of you.

On your aspx page, you will want to use a SqlDataSource and add two ControlParameters to the SelectParameters, one for the RadioButtonList, one for the TextBox/Calendar with the date. Then create a GridView control to display the results and set the DataSource of the gridview to be the SqlDataSource.

Depending on your database schema, the SQL Statement will look something like this:

SELECT * FROM [Parking] WHERE [LotID] = @LotID AND [Date] = @Date AND [Reserved] = FALSE;

However, I have done reservation systems in the past, and queries to find available spots for a particular day are rarely simple. I would suggest worrying about writing the SQL query first and then getting the web page to run the query later. If you post information about your table schema and tag it as a SQL question you'll probably have better luck.

Hope this helps.

Sign up to request clarification or add additional context in comments.

2 Comments

Before even starting this I would make sure you have a solid understanding of SQL Injection even though the above answer protects you
That's kind of surprising actually, but I'm glad I could help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.