c# - Error - SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM -


I have an app written for 2008.

We are using links to institutions.

We now have to switch to DB in 2005. I am getting the following error on linux SELECT queries:

Error - SqlDateTime overflow between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM should be there.

Abusive line is:

  Date offset = ((s.Date_Of_Birth == empty) || (s.Date_Of_Birth & lt; = lowdate))? DateTime.MinValue: s.Date_Of_Birth.Value,  

The date before us is the time of our kind and a property (not a unit) in our own business object.

Does anybody know how can I modify this line to run this query?

Ensure that lowdate is at least 1/1/1753.

If you try to supply a date before that date, then EF will change it and pass it in your query. In addition, you do not need to use the DateTime.MinValue in the query, but what will be your minimum:

DateOfBirth = ((s.Date_Of_Birth == Null) || (s.Date_Of_Birth & lt; = lowdate))? New Date Time (1753,1,1): s.Date_Of_Birth.Value;

Remember with EF, the query is compiled and the server is converted into SQL, so the values ​​should be appropriate there, as well.

It is being said, instead of using "Magic Value" ( DateTime.MinValue ), individually DateOfBirth to DateTime? Do I like to store as (faucet type)? Databases to catch empty or inappropriate values.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -