0

The Job model class has a column:

public DateTime JobDate { get; set; }

When I am trying to add a new Job, the input of JobDate is from

<input type="dateTime" name="JobDate" />

I get this error:

SqlException: The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value

How can I fix it?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Qianying Huang
  • 61
  • 1
  • 1
  • 3

1 Answers1

0

I recently ran into a similar issue. One solution I came across was to make the DateTime column nullable by adding a "?" to the model:

public DateTime? JobDate { get; set; }

JDevenyi
  • 101
  • 6