System.ArgumentException:正在使用的SQL Server版本不支持数据类型'datetime2

Sve*_*a26 1 sql entity-framework entity-framework-4 entity-framework-4.1

我刚刚上传了一个新版本的代码到我的服务器并得到了这个错误,我无法理解,也不知道如何解决 - 我没有更改datetime2 - 我的代码语法中甚至没有这个词.你知道那是什么意思吗?

执行命令定义时发生错误.有关详细信息,请参阅内部异常

InnerException:System.ArgumentException:正在使用的SQL Server版本不支持数据类型"datetime2".

at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC [] rpcArray,Int32 timeout,Boolean inSchema,SqlNotificationRequest notificationRequest,TdsParserStateObject stateObj,Boolean isCommandProc)

在System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean async)

在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String method,DbAsyncResult result)

在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String method)

在System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior,String method)

在System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior行为)

在System.Data.Common.DbCommand.ExecuteReader(CommandBehavior行为)

在System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand,CommandBehavior behavior)

Sve*_*a26 7

事实证明,实体框架4以某种方式获得了使用SQL Server 2008的想法.修复是在XML编辑器中编辑.edmx文件并设置ProviderManifestToken="2005"而不是2008.(您需要重建.)