ERROR: The version of SQL Server in use does not support datatype 'datetime2'

我把程序中的Entity Framework的SQL2012的数据库转为SQL2005后

出现了错误:

The version of SQL Server in use does not support datatype 'datetime2'.

解决办法:

把.edmx后缀文件中的

<Schema Namespace="NerdDinnerModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2012" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">

改为

<Schema Namespace="NerdDinnerModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">

即可

不允许评论