SqlDateTime overflow

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • baburk
    New Member
    • Oct 2006
    • 111

    SqlDateTime overflow

    HI

    I want to pass null or ""

    When I pass like that I got an error

    System.Data.Sql Types.SqlTypeEx ception: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

    Is there is any possibility to send null or ""

    Then how?

    Advance Thanks
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by baburk
    HI

    I want to pass null or ""

    When I pass like that I got an error

    System.Data.Sql Types.SqlTypeEx ception: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

    Is there is any possibility to send null or ""

    Then how?

    Advance Thanks
    Where do you want to pass this null?
    Can you post the code that you used that caused the exception.

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      You are supposed to pass date and time to a DateTime field not NULL .

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        You cannot apply a null or "" value to a datetime field (maybe you can get away with not addressing the column at all if its set to allow null, but that is a bad way)
        Try using DateTime.MinVal ue as a null value. I think it's like 1/1/0000 currently. And at any rate you can just look to see if the column matches DateTime.MinVal ue instead of checking to see if it's null.

        Comment

        Working...