Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click Dim medate As String = TextBox1.Text Dim st As String = ConfigurationManager.ConnectionStrings("testingConnectionString").ToString Dim con As New Data.SqlClient.SqlConnection(st) con.Open() Dim q As String = "insert into mytest values('" & medate & "')" Dim com As New Data.SqlClient.SqlCommand(q, con) com.ExecuteNonQuery() con.Close() End Sub
Conversion failed when converting datetime from character string.
Dim medate As New DateTime TextBox1.Text = System.DateTime.Today.Date medate = DateTime.Parse(TextBox1.Text) 'or medate can have your date of format mm/dd/yyyy Dim q As String = "insert into mytest values('" & medate & "')"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)