Cant understand the reason for this bug.
The conversion of a datetime 2 data type to a datetime data type resulted in an out-of-range value.
The data type in Sql server for this column is DateTime and Not Null is selected while creating the column.
On debugging systems datetime is saved in the column exception occurs in SaveChanges.
On searching I got this
The Conversion.. But didn't helped in my situation.
Model
public class Student
{
[Key]
public int StudentId { get; set; }
public DateTime CreatedDate { get; set; }
}
Action
public ActionResult Save(ViewModels.Student student)
{
var model = new ViewModels.Student();
model.CreatedDate = System.DateTime.Now;
db.Student.Add(student);
db.SaveChanges();
return View(model);
}