Please im developing an application reserves rooms for clients
it is in a way that you cannot insert another clients details if another client has chosen the room for a particular date.
i have binded a comobox with a database that contains information about the various rooms.

on clicking on the combobox that contains the room names and the date a client wants, if it is already booked for in a database, it should bring a message box that the room isnot available.else, if no client has chosen the room for the same date, we can go ahead and book the room for the new client.
how do i use the combobox to retrieve information from the database?

Recommended Answers

All 2 Replies

You run a query on the database to determine if the room is booked for the requested time. I can't be any more specific becuase you haven't provided any details. But as an example, assuming that bookings are for one hour periods, then the query

select * from bookings where room='C101' and day='2012-07-28' and hour=14

would return one record if room C101 was booked for 2 PM on July 28 by someone else, and zero records if it was free for use.

You can also use Select count(*) from bookings instead of Select *

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.