2013-04-08 60 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

相關問題