Conversion failed when converting date and/or time from character string.
my type data column is time(7)
my code is
Protected Sub insertdata()
Dim cls As New Class1
cls.openconnections()
Dim cmd As New SqlClient.SqlCommand
cmd.Connection = cls.cn
cmd.CommandText = "Insert Into Schedule (Room ,Hostel,Tanggal,Jam)"
cmd.CommandText &= "Values (@room,@hostel,@tanggal,@jam:@menit:00)"
cmd.Parameters.AddWithValue("@hostel", listhotelx.SelectedValue)
cmd.Parameters.AddWithValue("@room", listroomx.SelectedValue)
cmd.Parameters.AddWithValue("@tanggal", Calendar1.SelectedDate.ToShortDateString)
cmd.Parameters.AddWithValue("@jam", jam.SelectedValue)
cmd.Parameters.AddWithValue("@menit", menit.SelectedValue)
cmd.ExecuteNonQuery()
cls.closeconnection()
End Sub
Thank for help.
You have to concatenate the strings in time format
hh:mm:ssand then assign to the parameter.