Entity framework error: The conversion of a datetime2 data type to a datetime data
        Posted  
        
            by 
                EdenMachine
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by EdenMachine
        
        
        
        Published on 2011-03-20T00:07:38Z
        Indexed on 
            2011/03/20
            0:10 UTC
        
        
        Read the original article
        Hit count: 447
        
sql-server
|entity-framework
I know there are a ton of posts about this issue but none of them seem to solve my problem.
Here's the scenario:
I have a CreateDate DateTime column in my MS SQL Server database User table that is non-nullable and is automatically set using GetDate() method in "Default Value or Binding" setting.
I am able to create a User just fine with the standard EF Insert but when I try to update the user, I get this error:
The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.
What is the trick to not having the EF worry about the CreateDate column for updates? I have the StoreGenerationPattern = Identity but that isn't helping.
Here are the EF properties for my Entity Property: http://screencast.com/t/8ndQRn9N
And here is my Update method: http://screencast.com/t/UXIzhkhR
© Stack Overflow or respective owner