Not pretty but it resolves that invalid string error.
ASP code / mark up:<asp:TextBox> TextMode='Date' ID='StartDateBox' runat='server'</asp:TextBox>Visual Basic server code:
<asp:TextBox> TextMode='Time' ID='StartTimeBox'runat='server'</asp:TextBox>
Dim sTime As DateTime = Convert.ToDateTime(StartTimeBox.Text.toString)
Dim insertstring as String='INSERT INTO [sometable] (Start_Date, Start_Time) values (@sd, @st)'
Dim mySqlcmnd = New MySqlCommand(insertstring, [your db connection])
mySqlcmnd.Parameters.AddWithValue('sd', StartDateBox.Text)
' 24 hour format
mySqlcmnd.Parameters.AddWithValue('st', sTime.ToString("HH:mm"))
Dim rowCnt as Integer = mySqlcmnd.ExecuteNonQuery
No comments:
Post a Comment