跳到主要內容

entity framework在SQE Server 2005 / 2012之間變換環境的問題.

ASP.NET C#
MVC 4.0
Entity Framework 6.0


測試環境:SQL Server 2012
正式環境:SQL Server 2005

遇到問題:
在測試環境都沒問題。
但是程式移到正式環境後,只要用entity framework linq查詢到datetime格式就出現例外狀況!!!

解法如下:
Open your EDMX in a file editor (or “open with…” in Visual Studio and select XML Editor). At the top you will find the storage model and it has an attribute ProviderManifestToken. This has should have the value 2008. Change that to 2005, recompile and everything works.
NOTE: You'll have to do this every time you update the model from database.

來源網址:http://stackoverflow.com/questions/316422/using-sql-server-2008-and-sql-server-2005-and-date-time


留言

這個網誌中的熱門文章

台大教授的網站

陳少傑教授 http://soclab.ee.ntu.edu.tw/http2005/ CAD System Lab 軟硬體共同設計 (Hardware-Software Co-Design) Introduction to Electronic Design Automation 計算機結構 (Computer Architecture) 陳耀文教授 Introduction to Digital systems, Spring 1998 Introduction to VLSI Design, Fall 2000 Physical Design for Nanometer ICs, Spring 2007 Algorithms, Fall 2007 NTU SOC VSLI-EDA

[SQL]暫存資料表重覆確認(temp table)

在MS SQL Server下, 若要避開暫存資料表重覆建立的問題, 可以使用T-SQL語法判斷:OBJECT_ID('tempdb..#TEMP_TABLE_Name') 例如: IF OBJECT_ID('tempdb..#TEMP_TABLE') is not NULL DELETE FROM #TEMP_TABLE --暫存資料表已存在 ELSE Create TABLE #TEMP_TABLE(CITY NVARCHAR(255),TOWNS NVARCHAR(255)) --暫存資料表未存在