Firstly you should use a parameterised query - this is good practice because it will make your SQL statement easier to read and you don't have to convert every value to a string. It will also help to avoid a possible SQL injection attack on any string inputs you may have.
Secondly how to find a solution depends on what data type these columns are in your database. If they are DateTime or Time then you could potentially use the value as is.
Dim sql As String = "update Location_tbl set StartTime= @starttime, EndTime= @endtime"
Using cn As New SqlConnection("Your connection string here"), _
cmd As New SqlCommand(sql, cn)
cmd.Parameters.Add("@starttime", SqlDbTypes.DateTime).Value = fromtimepicker.Value.TimeOfDay
cmd.Parameters.Add("@endtime", SqlDbTypes.DateTime).Value = TotimePicker.Value.TimeOfDay
Return cmd.ExecuteScalar()
End Using
If they are string types then just change the data type to something such as SqlDbTypes.VarChar
and pass the values with .ToString
on the end
Side Note; I think you are missing a WHERE
clause from the end of your sql statement (unless there is only every going to be one row in this table?)