Mssql Query No Longer Works With Windows 10 Client: The Conversion Of A Varchar Data Type To A Datetime Data Type Resulted In An Out-of-range Value
We have been using the following SQL query for a long time in a WinForms program with no problems, until some end users upgraded to Windows 10. They suddenly get the exception:'ER
Solution 1:
I confirm that the solution purposed in this thread solved my problem.
After some research we found that the ToString("yyyy-MM-dd HH:mm:ss") call responded differently in Windows 7 and Windows 10 if the current culture was set to "no" or "nb-NO" at runtime (Thread.CurrentThread.CurrentCulture = new CultureInfo("no");).
The suggested modification did the trick: ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture). This solves my problem, as the dots in the time formatting was its root cause.
But should ToString("yyyy-MM-dd HH:mm:ss") return different formatting in the same culture depending on OS? :O This is kind of scary.
Post a Comment for "Mssql Query No Longer Works With Windows 10 Client: The Conversion Of A Varchar Data Type To A Datetime Data Type Resulted In An Out-of-range Value"