date intervals

  • Thread starter Thread starter Angelina
  • Start date Start date
A

Angelina

Hi

I have got 2 dates that need to be stored on my access
database. arrival_date and departure_date. these values
are entered by a user who is making a room booking. What
i wanted to know is if there is a function in vb.net that
recognises this as an interval and therefore stops
bookings for the same room being made that falls between
this interval.

eg:

Booking 1 for room 1: arrival_date = 1/1/2000
deputure_date = 10/1/2000

Booking 2 for room 1: arrival_date = 5/1/2000
deputure_date =15/1/2000

the second booking will be allowed in my DB as it unique
although the room is not even available. what can i do to
avoid this?

any help would be grateful.
 
Hi Angelina,

Assume that you have a table that has room number, arrival date and
departure date. Whenever a booking is attempted, you would first have to
select all rows for the appropriate room; then loop through them to see if
any have a date 'between' the new booking range. If the answer is yet, you
simple do not book and send back a message 'room unavailable during this
period.

From a practical point of view, you should really check for the range less
one day, as the departure date may well be a day when the room is available.

HTH,

Bernie Yaeger
 
Back
Top