I have here a column in a DataGridview with the name "DBO" (date of birth) that is in the month / day / year format, I wanted to change the date style to dd-MM-yyyy but I can not.
myCommand = "UPDATE DoctorBasic SET " & _
"DOB = '" & Convert_Null(DGV1(9, 0).Value.ToString("dd/MM/yyyy"), #1/1/1900#)** & "' " & _
"WHERE DoctorId = " & DGV1(0, 0).Value
cmd = New SqlCommand(myCommand, myConnectionString)
MsgBox(myCommand)
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
The convert_null is intended to display this date 1/1/1900 as default if the record you are looking for does not have a date and you want to record some changes to avoid error because the field is null.