Auto Ad Code

Tuesday, June 5, 2012

The version of SQL Server in use does not support datatype 'datetime2' [SOLVED]

While using the Enitity framework you can come across the following error.
The version of SQL Server in use does not support datatype 'datetime2'
You must have checked your Database tables that if you have set datatype datetime2 for some field and I am sure you didn't find any of such field.
Okay, the problem is with the entity framework and not with the SQL Server.

Here is the Solution
1. Open your EDMX file in XML Editor or any file editor (like notepad).
2. Search for ProviderManifestToken in the file (it should be in top 7-8 lines)
3. It will be having the value 2008 (or may be 2010 in some cases).
4. Change the value from 2008 (or 2010) to 2005.
5. Save the file.
6. Run your code.
7. Hope the issue is not there any more.

No comments:

Post a Comment