One of the common error people face, when they use Entity Framework, is the exception "The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value." thrown. This occurs when the entity associated with the table being saved has a mandatory datetime field and you do not set it with some value. The default datetime object is created with a value of 01/01/1000 and will be used in place of null. This will be moved into the datetime field which can hold date value 1753-01-01 00:00:00 and not less than this leads to out-of-range exception. This error can be resolved by either making the datetime field to accept null or by initializing the field with a value.
相关文章
- [entity framework ] The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
- EF 6.0 The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value. c#中的时间
- conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
- The conversion of a varchar data type to a datetime data type resulted in an out-of-range value
- conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
- The conversion of a varchar data type to a datetime data type resulted in an out-of-range value
- The conversion of a varchar data type to a datetime data type resulted in an out-of-range value