error when inserting date value

  • Hi! i try add a record to table. i use sql server 2008 and asp.net. i'll add record using asp.net web form. i used datetimepicker plugin to format datetime value. the formatted date value becomes xx.xx.xxxx format.(instead of xx/xx/xxxx).but this time it gives error when i insert record. Error is String was not recognized as a valid DateTime.".

    what can the problem is about?

    Thanks.

  • The setting of DATEFORMAT might be different than the format sent by the app.

    Example: if the dateformat in the database is day/month/year and it's send in month/day/year, you'll get an error if you're trying to insert '07/29/2011'.

    The best way to send a date format is YYYYMMDD, since this will always be recognized as a valid date format independent of the DATEFORMAT setting at the database. In the give nexample this would be '20110729'. Make sure not to send it as an integer value though...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply