开发者

Unexpected error about DateTime type

I have a .aspx page for adding new product include the following field:

ID, Name, DateTime, Price

and 开发者_JAVA百科it run well at localhost but when I publish it and up to the server, then I get the following error:

System.Data.UpdateException: An error occurred while updating the entries. See the InnerException for details. ---> System.ArgumentException: The version of SQL Server in use does not support datatype 'datetime2'

Localhost: SQL Server 2008 R2
Server: SQL Server 2005 Express

Although I generate the database to SQL 2005 format and make sure that there is no 'datetime2' datatype but the error is still here. I don't know why. Please give me a hand.

Any helps would be appreciated!


I assume you're using Entity Framework and have built the EDMX against a SQL Server 2008 database. To fix:

Right click on your .edmx file and click "Open With" then select "XML Editor" to edit the XML. Add the following attribute to the <Schema> tag:

ProviderManifestToken="2005"

This will instruct the Entity Framework to be compatible with SQL Server 2005.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜