I'm working with VB.NET Windows Form and an Access DataBase. A table in the database stores room numbers and the reservation dates for these rooms (checkin and checkout) among other things.
Here's the code used in the search function:
provider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source ="
'Change the following to your access database location
dataFile = "C:\Users\fongf\Desktop\FYP_Database\FYP.accdb"
connString = provider & dataFile
myConnection.ConnectionString = connString
Dim cmd As String = "SELECT * FROM Reservation WHERE (checkin > " & "#" & DateTimePicker1.Text & "#" & " and checkin > " & "#" & DateTimePicker2.Text & "#" & ")" & " or " & "(checkOut < " & "#" & DateTimePicker2.Text & "#" & " and checkOut < " & "#" & DateTimePicker1.Text & "#" & ")"
Dim dr As OleDbDataReader = cmd.ExecuteReader
If reservation = True Then
MsgBox("Sorry, this room was booked", MsgBoxStyle.OkOnly, "Invalid Login")
MsgBox("all is ok")
Sorry if the question seems silly, but I haven't had much experience dealing with databases and time. Your help or pointing me to a source with good information on this would be greatly appreciated. Thank you.
8/22/2022 - Mon
Your help has saved me hundreds of hours of internet surfing.