I have a number of optional input parameters I am using in a C# class method. Since the optional syntax creates a value of \'0\' when the parameter is not used, the SQL inse
Another clear way to set a null datetime parameter when necessary
if(obj.myDate == DateTime.MinValue) { aCommand.Parameters.Add("dateParameter", SqlDbType.Date).Value = DBNull.Value; } else { aCommand.Parameters.Add("dateParameter", SqlDbType.Date).Value = obj.myDate ; }