myCommand.Parameters.Add with a NULL value in a smalldatetime field
I'm having dramas inserting null a null value into my database smalldatetime field.
I check the fields first on the form
Dim strDate As String
If Trim(myDay) = "" Or Trim(myMonth) = "" Or Trim(myYear) = "" Then
strDate = System.DBNull.Value.ToString
For some reason if there is a value my code works, but the System.DBNull.Value.ToString doesn't work with or without quotes added.
It is actually in a function that is across the entire site. It drops dates into SQL and it is used for parameters.
Is there a way I can get it to do both with out changing all of the places it is used?