Montag, 10. Mai 2010

Entity Framework and datetime2

Today I was a little bit confused about a error message “…conversation error for datetime2 in datetime…”. Because in my database scheme I am not using any new SQL Server 2008 datetime2 data types. After a while of researching, I found out that the Entity Framework 4 internally works with the datetime2 data type and wants to convert it in my datetime database type.

To use the datetime data type in Entity Framwork 4 you have to switch the ProviderManifestToken in the edmx-file to "2005". After thisn the Entity Frameweok 4 will work with the datetime data type.

1 Kommentar:

  1. Hi, I've tried using datetime2 instead of datetime and it dosen't give me that conversion error or any error.
    It gives me the date of : 01/01/0001
    (this is when I want to add new records to my datagrid)
    --
    Misi

    AntwortenLöschen