.net - LINQ to Entities produces query containing datetime2 on SQL 2005 Express -
I have a VS 2010 Solutions is a unit project and a database project to manage schema in targeting. Net 4.0 The unit model is currently reverse engineered from the database. One of the tables is defined with one type of column. The database project is configured to use SQL Server 2005 compatibility mode and therefore it deploys all properly.
I have just attended a problem where an update statement appears to use datetime2 instead of datetime2, through the unit structure, which causes exception because of the SQL 2005 data type Does not support:
System.Data.UpdateException: An error occurred while updating the entries. See Internal Exceptions for details --- & gt; System.ArgumentException: The version of SQL Server in use does not support data type 'datetime2'
The stack trace appears to be occurring inside this error:
I have looked through all my SQL code and entity code and confirmed that datetime2 (including dbschema file) ) There is no reference available. I can only conclude that the data type is being generated in the dynamic SQL query generated by the entity's structure.
How can I confirm or reject this, and how should I stop it? The unit structure does not know that I have asked the DB Project to target the 2005 compatibility mode, and I can not find any way to point to the version that it is looking at. What matters for this, I made this project on the machine that had set up the 2008 Express, but I switch from time to time on another machine (and can not yet upgrade).
You need to change the ProviderManifestToken
inside EDMX inside your code . You probably generate your DB against a 2008 DB. Make this change and the use of EF 2008 syntax will stop.
Comments
Post a Comment