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

后端 未结 23 1334
旧时难觅i
旧时难觅i 2020-11-28 20:19

I have the following code in my HomeController:

public ActionResult Edit(int id)
{
    var ArticleToEdit = (from m in _db.ArticleSet where m.storyId == id se         


        
23条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 20:50

    Got this problem when created my classes from Database First approach. Solved in using simply Convert.DateTime(dateCausingProblem) In fact, always try to convert values before passing, It saves you from unexpected values.

提交回复
热议问题