I want to get the work hour schedule for employees to show up in the labels of a form. The input will be = IDdeEmpleado "Employee ID" and Fecha "Date" and it should get Horadecomienzodetrabajo "Start"and horadeConclusiondeTrabajo "Finish".
This is the code I have so far 'the query:
Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM [Horario] WHERE [IddeEmpleado] = @Id AND [Fecha] = @Fecha ", myConnection)
cmd.Parameters.AddWithValue("@Id", txtEmpID.Text)
cmd.Parameters.AddWithValue("@Fecha", SqlDbType.Date).Value = lblDate.Text
Dim dr As OleDbDataReader = cmd.ExecuteReader
Dim HoradeEntrada As String = ""
Dim HoradeSalida As String = ""
'if found:
Try
HoradeEntrada = dr("HoradeComienzodeTrabajo")
HoradeSalida = dr("HoradeConclusiondeTrabajo")
lblComienzo.Text = HoradeEntrada
lblTermina.Text = HoradeSalida
Catch
MsgBox("Sorry,No Hay Horario para el ID Entrado", MsgBoxStyle.OkOnly, "Invalid ID")
End Try
HoradeComienzodeTrabajoandHoradeConclusiondeTrabajocolumns?Stringvariables for one thing. You should be assigning them toDateTimevariables in your VB code first and then, at the very least, you can look at the values in their native form and then go form there. If thoseDateTimevalues have their time portion set to zero then there's no time values in the database to begin with, so there's nothing you can do in your retrieval code to fix that. In that case, it would be your saving code that's the issue.