When I attempt to write a record to the database I get this error message. I understand the error message occurs because I have left one of the date fields blank but in many cases the data is not necessary. What is the easist way to program around this so this error does not occur if the field is left blank?
Here is some sample code where I get one of the data fields:
cmd.Parameters.Add("@DATEO
FEXAM", SqlDbType.DateTime).Value = dtDateOfExam.Value;
cmd.ExecuteNonQuery(); --- error occurs here when the record is written to the table
Start Free Trial