Hello Friends,
I need one urgent help on this topic.
I have a database in mysql.
The column in table is of datatype time(0)
Similarly I have a control datetimepicker in vb.net
I have assigned format property as custom to the control and the CustomFormat property as HH:mm:ss tt so that it can just provide the time.
I dont want the date to be in it.
Issue comes when I try to retrieve the value from database
I get an error as Converion of type 'Timespan' to type 'Date' is not valid
Can anyone help me in this?
Try
Dim myCommand As SqlCommand
myCommand = New SqlCommand("select * from [HMS].[dbo].[DoctorSchedule] where DoctorID='" & txtDoctorID.Text & "'", Connection)
Dim reader As SqlDataReader = myCommand.ExecuteReader
While reader.Read
TextBox1.Text = reader("ScheduledID")
dtpMonST.Value = reader("MonST")
End While
Catch ex As Exception
MessageBox.Show("Error Connecting to Database: " & ex.Message)
End Try