SQL Server Performance

DateTime update problem from typed dataset.

Discussion in 'SQL Server 2005 General Developer Questions' started by jn4u, Apr 28, 2009.

  1. jn4u Member

    The database is in the collation Finnish_Swedish_CI_AS and I have table with a datetime column. We have an application that u are able to change language in. This change the culture information inside the application. Inside the application we are using strongly typed datasets. The dataset has the column set to the System.DateTime and UnspecifiedLocal. Running in Swedish mode that dataset read the date correctly and updates correct. But when switching to another language the application thinks that this #4/28/2009 10:36:28 AM# is char when trying to update. With a Adapter.Update(table). The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. The statement has been terminated.
  2. Madhivanan Moderator

    What happens when you use the format #20090428 10
    :36:28 AM#
  3. satya Moderator

    Make sure the date has the correct format (DDMMYYYY, MMDDYYYY, etc.) Also, you can make an explicit conversion passing the date in that way:

    CAST('12/12/1998' AS DATETIME) instead '12-12-1998'

Share This Page