SqlException:將datetime2數據類型轉換爲datetime數據類型導致超出範圍的值。如何修復「SqlException:將datetime2數據類型轉換爲日期時間數據類型導致超出範圍值。」
我的代碼是這樣的:
using (var contxt = new realtydbEntities())
{
var status = GetStatus();
var repIssue = new RepairIssue()
{
CreaterId = AuthorId,
RepairItemDesc = this.txtDescription.Text,
CreateDate = DateTime.Now,//here's the problem
RepairIssueStatu = status
};
contxt.AddObject("RepairIssues", repIssue);
contxt.SaveChanges();
}
的CREATEDATE屬性映射到列哪種類型SMALLDATETIME。
如何讓這段代碼運行?
[將datetime2數據類型轉換爲datetime數據類型導致超出範圍?](https://stackoverflow.com/questions/7386360/the-conversion-of-a- datetime2-data-type-to-a-datetime-data-type-result-a-o) –