locked
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM RRS feed

  • Question

  • User87195929 posted

    Hi all

    I am geting error


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

    please assist me on this issue

    Wednesday, August 30, 2017 6:18 AM

All replies

  • User541108374 posted

    Hi,

    check your code. Likely you're trying to put a DateTime.MinValue or so in the database and it complains about it as it starts only in 1753.

    So either go for a datetime of 1/1/1753 or make the field in the database nullable, make the property in your code DateTime? (nullable DateTime) and pass in null if you don't have a date and it'll become NULL in the database.

    Kris.

    Wednesday, August 30, 2017 6:24 AM
  • User347430248 posted

    Hi siddangoud,

    you did not posted the code and only post the error.

    it is helpful for us to find the cause of the issue, if you post the code.

    most possible is you are trying to pass the value that is not supported by SQL.

    so the error will not be generated by Visual Studio but when you try to insert data to SQL. SQL will not allow you to enter the value and generate error.

    you can try to debug your code and try to check which exact value is passing and try to check whether something is wrong with that value or not.

    if you find any issue with that then try to correct it and check again.

    you can also try to post the code and the values your passing here.

    we will try to check it on our side and let you know about the problem.

    Regards

    Deepak

    Thursday, August 31, 2017 6:34 AM