实体框架错误 - 的SQL Server所使用的版本不支持数据类型'DATETIME2“ [英] Entity Framework Error - The version of SQL Server in use does not support datatype 'datetime2'

查看:1291
本文介绍了实体框架错误 - 的SQL Server所使用的版本不支持数据类型'DATETIME2“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ASP.NET 4.0 Web窗体使用实体框架4.0。



所有是开发服务器上的罚款。但是,当我到生产服务器,我在我的ELMAH记录这个错误




System.ArgumentException结果
的版本在使用SQL Server不支持
数据类型DATETIME2。




我做了一个快速调查,结果发现, DATETIME2 又名 DATETIME2(7)的问题和设置 ProviderManifestToken =2005年的将解决这个问题。



我的问题是这样的。我的开发服务器有 SQL Server 2008 R2的并生产服务器具有 SQL Server 2008 Express的。因此,改变清单到2005年看起来不正确。



我的问题是




  1. 将设定 ProviderManifestToken =2005年的工作?

  2. 为什么实体框架生成一个 DATETIME2 时,我没有用它在所有的任何表?

  3. 有没有更好的变通?


解决方案

我没有看到任何解决方法,直到日期。所以,如果你正在使用的 SQL Server 2008 Express的后,请右击你的EDMX,使用XML(文本)编辑器,并设置 ProviderManifestToken =2005年的



听起来并不好。但它的一切我已经得到截至目前。


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 error

System.ArgumentException
The version of SQL Server in use does not support datatype 'datetime2'.

I did a quick research and found out that datetime2 aka datetime2(7) is the problem and setting ProviderManifestToken="2005" will solve the issue.

My problem is this. My Development Server has SQL Server 2008 R2 and Production Server has SQL Server 2008 Express. So, changing the manifest to 2005 doesn't seem right.

My questions are

  1. Will setting ProviderManifestToken="2005" work?
  2. Why has Entity Framework generated a datetime2 when I haven't used it at all in any of the table?
  3. Is there a better work around?

解决方案

I dont see any workaround till date. So if you are using SQL Server 2008 Express, please right click on your edmx, open it with XML (Text) Editor and set ProviderManifestToken="2005".

Doesn't sound that good. But its all I have got as of now.

这篇关于实体框架错误 - 的SQL Server所使用的版本不支持数据类型'DATETIME2“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆