异常描述:

  数据访问用EF,在数据库中用getdate()设置的默认值,程序中没有赋值。

  出现异常。

  此错误在百度上在我写此文之前没有多少解决方案,谷歌之等到以下两个有用的页:

  http://stackoverflow.com/questions/1331779/c-sharp-conversion-of-a-datetime2-data-type-to-a-datetime-data-type

  http://stackoverflow.com/questions/4608734/the-conversion-of-a-datetime2-data-type-to-a-datetime-data-type-resulted-in-an-o

错误的原因:

  由于在.net中DateTime的范围中是0001-01-01开始的

 

  datetime2((Transact-sql))的范围:0001-01-01 到 9999-12-31

  datetime(Transact-sql):1753 年 1 月 1 日到 9999 年 12 月 31 日

相关文章:

  • 2022-12-23
  • 2021-11-29
  • 2021-08-04
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
猜你喜欢
  • 2022-12-23
  • 2021-12-04
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案