2013-04-08 42 views
3

我的开发服务器是MS SQL Server 2008和Visual Studio 2012.该项目工作正常,当我在本地运行但当我尝试运行相同的项目服务器然后它给了这个错误,并不允许插入或更新日期。 错误: “正在使用的SQL Server版本不支持数据类型'datetime2'。”正在使用的SQL服务器的版本不支持数据类型'datetime2'

我的在线服务器正在使用MS Sql Server 2005. 我没有使用数据类型为“datetime2”的任何字段,所有字段都具有数据类型datetime。 其次我也试图通过更改字段从ProviderManifestToken =“2008”到ProviderManifestToken =“2005”,但它不起作用。

+0

你有使用'DATETIME2'任何功能,类型或存储过程? – Oded 2013-04-08 12:19:47

+0

没有使用此数据类型的存储过程。 – 2013-04-08 12:39:01

回答

2

您不必使用DATETIME2在数据库中得到这个error.see这个question

This error happens usually once you add required (NOT NULL) DATETIME column to existing table and you don't set the value prior to saving the entity to database. In such case .NET will send default value which is 1.1.0001 and this value doesn't fit into DATETIME range. This (or something similar) will be source of your problem.

+0

我在使用DateTime.Now;设置当前记录的日期时间。 – 2013-04-08 12:41:40

+0

@FahadMahmood工作? – 2013-04-08 12:42:25

+0

请不要分享这个链接 – 2013-04-08 12:53:41

相关问题