Entity Framework Error - The version of SQL Server in use does not support datatype 'datetime2'

后端 未结 3 1694
不思量自难忘°
不思量自难忘° 2021-01-06 10:28

I am using Entity Framework 4.0 in an ASP.NET 4.0 Web Form.

All is fine on the development server. But when I get to the production server, I my Elmah logs this erro

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-06 11:09

    I found that the answer in this blog post worked for me: The version of SQL Server in use does not support datatype 'datetime2'

    It turns out that Entity Framework 4 somehow got the idea to use SQL Server 2008. The fix was to edit the .edmx file in an XML editor and set the ProviderManifestToken="2005" instead of 2008. (You need to rebuild.) Here’s how the line should look against SQL Server 2005:

    
    

提交回复
热议问题