I need to update a date field in a table that's of type DATE with data from DateTimePicker control
I changed the format of the control as updated the table as shown below
dtp1.Format = DateTimePickerFormat.Custom
dtp1.CustomFormat = "yyy-MM-dd"
query = "INSERT INTO student_attendance_table(regno,date,year,batch) VALUES('1138M0343', " & dtp1.Text & ", " & year & ", " & batch & ")"
con.Open()
cmd = New SqlCommand(query, con)
cmd.ExecuteNonQuery()
con.Close()
But the table is not getting updated. Instead showing the following error
Operand type clash: int is incompatible with date
dtp1.CustomFormat = "yyy-MM-dd"