Hi,
I am new to vb.net and I am trying to use a datetime picker in my form.
While inserting date to the sql server in datetime column I am getting an error stating it cannot convert the string to date.
I understand the fact that I am trying to insert string into date column, hence please help me with the right code. Here is the code I am using.
Dim sqlCmdStr_Insrt As String = "INSERT INTO Project_details(project_Id,Project_name,Description," _
& "Stdate,NdDate)Values('" & txtPro_id.Text & "','" & txtPro_Nm.Text & "','" & txtPro_Dsc.Text & "','" _
& dateSt_Projct.Value.ToLongDateString & "','" & dateEnd_Project.Value.ToLongDateString & "')"
Try
'Executing the Sql Query to insert the data to the Project_details table
DataStore.ExecuteNonQuery(sqlCmdStr_Insrt, sqlConnStr)
Call btnReset_CrtPro_Click(sender, e)
Catch ex As Exception
MsgBox(ex.ToString)
End Try