After some consideration and realising that there were a few things I did not take into account, I've decided to rather take the processing to the client.
Things I did not take into account:
1. StartOfDay Time (Start of Office Hours)
2. EndOfDay Time (End of Office Hours)
3. Get First Booking - to check for an un-allocated time period between First Booking and StartOfDay
4. Get Last Booking - to check for an un-allocated time period between Last Booking and EndOfDay
I've used a simple If..Else statement block to implement the logic and it takes only 11 code lines to check for everything.
First I check for First Booking and then check to see if I have an open time period between the First Booking's StartTime and StartOfDay time.
The Second check is for the Last Booking to see if there is an opening between the Last Booking's EndTime and EndOfDay time.
The third part is to process all bookings between the First and Last Booking.
If j = 0 AndAlso myEndTime <= dbStartTime AndAlso
myStartTime >= StartOfDay AndAlso (dbStartTime - StartOfDay) >= myTimeSlot Then
txtResults.AppendText("Found Time Slots" & vbCrLf)
ElseIf j = clReadFromDB.tmsData.Rows.Count - 1 AndAlso myEndTime <= EndOfDay AndAlso
(EndOfDay - dbEndTime) >= myTimeSlot Then
txtResults.AppendText("Found Time Slots" & vbCrLf)
ElseIf myStartTime >= clReadFromDB.tmsData.Rows(j).Item(2) AndAlso
myEndTime <= clReadFromDB.tmsData.Rows(j + 1).Item(1) AndAlso
(clReadFromDB.tmsData.Rows(j + 1).Item(1) - clReadFromDB.tmsData.Rows(j).Item(2)) >= myTimeSlot Then
txtResults.AppendText("Found Time Slots" & vbCrLf)
lblStatus.Text = Convert.ToString(clReadFromDB.tmsData.Rows(j + 1).Item(1) - clReadFromDB.tmsData.Rows(j).Item(2))
Else
lblStatus.Text = "Time Slot not found"
txtResults.AppendText("Time Slot Not Found" & vbCrLf)
End If
I will use the above code as the foundation logic because this runs through all the bookings on the DB. It also uses the First Booking as the initial check instead of the Calendar Time the user selected for the new Booking.
Thank you to those who tried to assist, even though your suggestions did not bring me closer to a MySQL solution, it did however broaden my knowledge of MySQL.