I am building a school project which is a room booking service. I have reached the part of the programming where I need to figure out how to store bookings. I know how to pull from a database using VB and I've laid it out like that when I try to pull booking information from the database.
strBookingQuery = "SELECT * FROM bookings WHERE Date = '" & InputBookingDate & "'"
Dim Cmd As New MySqlCommand(strBookingQuery, Newconnection)
Newconnection.ConnectionString = strServerString
Newconnection.Open()
reader = Cmd.ExecuteReader()
reader.Read()
StartPeriod = reader.GetInt16(1)
Length = reader.GetInt16(2)
UserID = reader.GetInt16(3)
RoomID = reader.GetInt16(4)
Newconnection.Close()
But when it gets to StartPeriod = reader.GetInt16(1) it says Invalid attempt to access a field before calling Read(), is this because MySQL stores dates in a different way? Or something else? Any help would be greatly appreciated :)