04 July 2011

.NET Entity Framework - The version of SQL Server in use does not support datatype ‘datetime2′

I developed an application using the .NET Entity Framework and SQL Server 2008 on my local machine. When I moved it onto the production server, which runs SQL Server 2005, it threw this error as inner exception when trying to save a DateTime:
The version of SQL Server in use does not support datatype ‘datetime2′.
The solution is changing a setting in the Entity Framework to target SQL Server 2005 instead of 2008. This setting is not available through the IDE, so:
  1. Open the *.edmx,
  2. Find the ProviderManifestToken attribute on the Schema tag,
  3. Change it's value from 2008 to 2005,
  4. A rebuild might be necessary. 

No comments:

Post a Comment