|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 4:18 PM
Points: 363,
Visits: 574
|
|
I use .NET 4.0 and they did not update the date range limits in the libraries to match the new range in SQL Sever. I will have to wait until I get home, but will try to find a workaround I came up with and post it here for you.
This was a one week research project for me so if I can find my fix it could save you a ton of time.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Friday, February 22, 2013 11:14 AM
Points: 39,
Visits: 141
|
|
Thanks so very much. It would look like MS would fix this. I set my dates fields to "date" in sql and my time to "time(4)
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 4:18 PM
Points: 363,
Visits: 574
|
|
| Different dev teams I guess. Not very efficient.
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 4:18 PM
Points: 363,
Visits: 574
|
|
OK, just so everyone understands, this is not a SQL problem. The .NET Framework has a special data type for SQL databases in System.Data.SqlTypes.SqlDateTime. For some really silly reason, this data type's MinValue method has not been expanded to use the new minimum date. Probably because no one at Microsoft even thought about adding a SqlDateTime2 type, or any of the others like SqlDate and SqlTime.
What I had to do is find the code in my data access library that used SqlDateTime.MinValue to check dates before sending them to the database and changed it to use DateTime.MinValue. That will use the proper minimum date.
Do be sure and use DateTime2 in SQL or the database will be the next thing that will throw an error.
Hope this helps.
|
|
|
|