Select * from BookingInformation where theDate between Date In and Date Out and Room Number = 'Something'
Private Sub ReadRecords() Dim btn As Button = Nothing MyConn = New OleDbConnection MyConn.ConnectionString = connString MyConn.Open() str1 = ("SELECT * FROM [BookingInformation] WHERE [Date Out] = '" & dtpDateOut.Value.Date & "'") 'When searching this searches for the data that you are looking for' Dim cmd1 As OleDbCommand = New OleDbCommand(str1, MyConn) dr = cmd1.ExecuteReader While dr.Read() strRoomBooking = dr("Room Booking").ToString strDateIn = dr("Date In").ToString strDateOut = dr("Date Out").ToString If strDateOut > DateTime.Today Then If strRoomBooking = btn.Text Then btn.BackColor = Color.Red End If End If End While MyConn.Close() End Sub Private Sub Room_Booking_Load(sender As Object, e As EventArgs) Handles MyBase.Load ReadRecords() End If
<pre>Select * from BookingInformation where theDate between Date In and Date Out and Room Number = 'Something'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)