I have written a VB reservations program that writes back to a SQL 2008 database. When I write the reservation event back to the data base, I also write the reservation 'end time' back to the database as reservationtime + 4 hours in order to block off the event resource. the program works fine until I try to book an event at8:00 PM or later. When I try to book an event at 8 PM or after the SQL database throws an error, 'System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM'. I guess this is because the booked event then continues into the next day. I need to be able to block of the time space as reservations are accepted up to 2:00 am. Is there a work around?

here is the code I am using to creat the scheduled time block:

'Create apptEnd value by adding 4 hours to start reservation time requested
        Dim mperdtm As Date = TimeValue(ReservationTimeRequestedComboBox.Text)
        Dim mperNew As Date = DateAdd(DateInterval.Hour, 4, mperdtm)
        Dim strDT As Date = ReservationDateRequestedDateTimePicker.Text
        Dim cEndDT As Date = mperNew

   ApptEndTimeTextBox.Text = cEndDT
   ReservationTimeEndTextBox.Text = mperNew

i got it worked out, the time variable was adding "1/2/0001" to the begining of the entry...so i wrote it out to a string and did a .Replace("1/2/0001", "") to strip it off.

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.