C# SqlDateTime overflow

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jhansi xavier
    New Member
    • Nov 2008
    • 1

    #1

    C# SqlDateTime overflow

    SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    You have to give more information than that. Have you set the CultureInfo before setting into the database? Which value were you trying to set and what's the column definition for the receiving column?

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      This error is a pretty simple one, yet pretty common.
      The DateTime object in .NET can encompas a larger spanse of time then the SQL datetime can.
      Simply ensure that your datetime object falls between those ranges and you will be fine.

      Comment

      • balabaster
        Recognized Expert Contributor
        • Mar 2007
        • 798

        #4
        Does this mean we're going to have a Y10K issue? :oP

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          In old SQL databases yes I suppose.
          As far as using a 64bit DateTime value goes, they have been playing with toggling a bit to change what "0" means, i.e. if a certain bit is set, the rest of the bits corrospond to a date starting from further ahead in time then if the bit were not set.

          Comment

          Working...