Using sql date data type and EF4

2020-02-26 14:04发布

I have a table w/ a sql date data type. When I look at the EDM markup, the storage element reflects this. The conceptual entity has a data type of DateTime (there doesn't appear to be a Date data type). When I call save changes and have a DateTime instance associated w/ the entity I want to persist, I get the following error:

The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value. The statement has been terminated.

How can I use the date data type in my schema and have EF behave? Thanks!

1条回答
2楼-- · 2020-02-26 14:46

Sounds like your SQL date column is non-nullable, but you haven't initialized the date on your entity before saving?

查看更多
登录 后发表回答