c# - The conversion of a datetime2 to a datetime is out of range -


have read number of posts issue haven't found works.

our sql database has field set (data type of datetime)

enter image description here

the respective model property has following declarations

    [displayname("effective date")]     [column(typename = "datetime")]     [displayformat(dataformatstring = "{0:d}", applyformatineditmode = true)]     public datetime? effectivedate { get; set; } 

yet if enter date of 11/11/1111 following error when program runs dbcontext.savechanges()

the conversion of datetime2 data type datetime data type resulted in out-of-range value. statement has been terminated

i not aware of, nor have found, range specifications in our asp mvc project or on sql table. appreciated.

you have specified column type as:

[column(typename = "datetime")] 

this map dateime type column in sql server, and not datetime2.

datetime has valid range of january 1, 1753, through december 31, 9999 value 11/11/1111 out of range.

the error message includes datetime2 , due the provided value 11/11/1111, fall under datetime2 range.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -