79489231

Date: 2025-03-06 11:48:57
Score: 1
Natty:
Report link

This is caused by a datetime value of "0000-00-00" (a zero date) in a datetime column.

If this is intentional you'll need to use the "Allow Zero Datetime=True" connection string option.

More likely this is a data error and should be fixed in the table. NULL is the appropriate value for where there isn't a value for this type of field. You may need to alter the table to allow nulls for this column.

One reason why the column might not be nullable is if it's in a primary key. You can resolve this by using a known valid date as the 'null' value or using the connection string option. Using the connection string value will be more fragile, unless the need is well documented.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Matt Langley