正在使用的SQL Server版本不支持数据类型datetime2?
发布时间:2020-12-12 06:52:38 所属栏目:MsSql教程 来源:网络整理
导读:An error occurred while executing the command definition. See the inner exception for details. bbbbInnerException:aaaa System.ArgumentException: The version of SQL Server in use does not support datatype 'datetime2'. at System.Data.SqlClie
An error occurred while executing the command definition. See the inner exception for details. bbbbInnerException:aaaa System.ArgumentException: The version of SQL Server in use does not support datatype 'datetime2'. at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray,Int32 timeout,Boolean inSchema,SqlNotificationRequest notificationRequest,TdsParserStateObject stateObj,Boolean isCommandProc) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,String method,DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior,String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand,CommandBehavior behavioR 我有一个使用Entity Framework的网站。几个月前,我添加了一个新表,并在现有表中添加了一些列;一切正常。 今天我更新了EDMX的映射,以便可以使用新表和新列,并将WebMethods添加到我的services.asmx文件中。从那时起,我无法运行我的网站,因为我有一个我无法理解的错误。如果你明白了,请告诉我,并告诉我我的错误在哪里。 我没有在任何地方使用datetime2。我的新表中没有这样的数据类型,也没有添加到现有表的列中。 我的PC上的SQL版本是SQL2008 R2,在我有SQL2008的服务器上。我没有选择将服务器升级到R2。 解决方法除了@Mithrandir之外,还要验证您的数据库是否在兼容级别设置为100的情况下运行(SQL 2008)。您不必在数据库中使用DATETIME2来获取此错误。一旦将必需(NOT NULL)DATETIME列添加到现有表并且在将实体保存到数据库之前未设置该值,通常会发生此错误。在这种情况下,.NET将发送默认值1.1.0001,该值不适合DATETIME范围。这(或类似的东西)将成为您问题的根源。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |