Hi,
I am working on Hotel Application and I need your help on how to prevent booking a room twice. That is, if a room is booked for 3 days(24/2/2015(18.00) to 27/2/2015(7.00)), no room can be booked withing that period. Am developing the project with Asp.Net(VB) ans Sql Database.
Thanks in advance.
jonathan.paul.7543 0 Newbie Poster
Recommended Answers
Jump to PostOr retrieve the dates and match with the current dates to see if the booked room is available or not.
Jump to PostYou will need a table with your bookings.
Room_Number, Customer, Booking_Start, Booking_End. Primary key is Room_Number + Booking_Start. Unique key is Room_Number + Booking_End. Foreign keys are Room_Number (to table Rooms), Customer (to table Customers).
To check if a room has already been booked for a new booking do a …
Jump to PostDate fields also include the times. So a few records might look like:
Room_Number, Customer, Booking_Start, Booking_End 102, 1095, #April 4, 2015 16:00#, #April 7, 2015 10:00# 105, 27, #April 6, 2015 21:00#, #April 7, 2015 10:00# 102, 1022, #April 7, 2015 11:00#, #April 8, 2015 10:00# …
Jump to PostI just noticed a bug in what I told you. I will get back to you shortly after I test it on my copy of Access.
Jump to PostOkay, I found my mistakes. Here we go.
First, the table structure is as I described above, but the queries needed some help.
First, let's see what rooms are being used during a given time. In other words, given a time frame, which rooms are booked for anytime in that …
All 22 Replies
Minimalist 96 Posting Pro
Santanu.Das 125 Santanu Das
Mr.M 89 Future Programmers
Nutster 58 Newbie Poster
jonathan.paul.7543 0 Newbie Poster
Mr.M 89 Future Programmers
David_50 13 Junior Poster in Training
Nutster 58 Newbie Poster
Nutster 58 Newbie Poster
jonathan.paul.7543 0 Newbie Poster
Nutster 58 Newbie Poster
Mr.M 89 Future Programmers
jonathan.paul.7543 0 Newbie Poster
jonathan.paul.7543 0 Newbie Poster
Mr.M 89 Future Programmers
David_50 13 Junior Poster in Training
jonathan.paul.7543 0 Newbie Poster
David_50 13 Junior Poster in Training
Mr.M 89 Future Programmers
Mr.M 89 Future Programmers
jonathan.paul.7543 0 Newbie Poster
David_50 13 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.