使用SQL Server 2008和SQL Server 2005和日期时间 [英] Using SQL Server 2008 and SQL Server 2005 and date time

查看:134
本文介绍了使用SQL Server 2008和SQL Server 2005和日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了一个针对2008数据库的实体框架模型。所有的工作都可以对付2008数据库。当我尝试更新2005年数据库上的实体时,我得到这个错误。

I've built a entity framework model against a 2008 database. All works ok against the 2008 database. When I try to update the entity on a 2005 database I get this error.

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

I具体没有使用任何2008年的功能,当我建立数据库。我在代码中找不到任何datetime2的引用。而且,是的,列被定义为数据库中的datetime。

I specifically did not use any 2008 features when I built the database. I can't find any reference to datetime2 in the code. And, yes the column is defined as "datetime" in the database.

推荐答案

快速google指向我看起来像解决方案

A quick google points me to what looks like the solution.

在文件编辑器中打开EDMX(或在Visual Studio中使用...打开,选择XML编辑器)。在顶部,您将找到存储模型,它具有一个属性ProviderManifestToken。这应该有值2008年。将其更改为2005,重新编译和一切正常。

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.

这篇关于使用SQL Server 2008和SQL Server 2005和日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆