 看到这个错往往会感到莫名其妙! 其原因其实是数据库的`DateTime`最小值和C#的`DateTime`不一样 Sql Server `DateTime` 类型必须介于 `1/1/1753 12:00:00 AM` 和 `12/31/9999 11:59:59 PM` 之间,而C#的是从`0001/1/1`年开始 遇到这种情况先换转成`SqlDateTime`类型再转回`DateTime`类型 ```csharp using System.Data.SqlTypes;//sqldatetime namespace time1 = time2== DateTime.MinValue ? (DateTime)SqlDateTime.MinValue :time2; ``` Last modification:October 15th, 2019 at 04:26 pm © 允许规范转载 Support 如果觉得我的文章对你有用,请随意赞赏 ×Close Appreciate the author Sweeping payments Pay by AliPay Pay by WeChat