sql server 2012 - 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 following sql query long time in winforms program no problems, until end users upgraded windows 10.

they exception:"error [22007] [microsoft][sql server native client 11.0][sql server]the conversion of varchar data type datetime data type resulted in out-of-range value."

this error has been posted inside here earlier, did not find post occurrence connected windows 10 upgrade.

the query targeted sql server 2012, using native client 11. works on windows 7 , 8, throws exception in windows 10:

select distinct tblemployee.employeeid, tblemployee.lastname, (coalesce(tblemployee.firstname, '') + ' (' + coalesce(tblemployee.employeeidtext, '') +')' ) firstname  tblemployee  left join tblassignmentservice on tblemployee.employeeid = tblassignmentservice.employeeid  tblassignmentservice.servicedate >= '2015-08-31 00.00.00'  , tblassignmentservice.servicedate < '2015-09-07 00.00.00'  order tblemployee.lastname; 

the place datetime fields used in clause, , query works fine against same db windows 8 client. both clients run einglish windows versions. interesting observation query accepted microsoft sql management studio on windows 10 machine. not through native client. dates used in filter created in our program through gui.

have else experienced strange things native client on windows 10, or have suggestion how problem may solved?

i confirm the solution purposed in thread solved problem.

after research found tostring("yyyy-mm-dd hh:mm:ss") call responded differently in windows 7 , windows 10 if current culture set "no" or "nb-no" @ runtime (thread.currentthread.currentculture = new cultureinfo("no");).

the suggested modification did trick: tostring("yyyy-mm-dd hh:mm:ss", cultureinfo.invariantculture). solves problem, dots in time formatting root cause.

but should tostring("yyyy-mm-dd hh:mm:ss") return different formatting in same culture depending on os? :o kind of scary.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -