0

I am running some database automation tests in C#.The results of the same sql query are different in visual studio(executed via automation tests) and SQ Server Management studio(Manually).The difference is mainly with the date-time formats. Example: Management studio returns :2020-04-18 18:27:51.5354564 -04:00 Visual studio returns: 4/18/2020 6:27:51 PM -04:00

I don't understand what is causing the issue. Greatly appreciate any help to resolve this !

2
  • SQL Server management studio and visual studio are converting the dates to strings. I'd guarantee VS is using the US date format while SSMS is using its standard format. If you search for C# date formats you can find a lot of information about how C# displays dates.
    – Kate Paulk
    Commented Apr 23, 2020 at 15:41
  • How are you doing it through c# please add the code
    – PDHide
    Commented Apr 23, 2020 at 18:44

1 Answer 1

2

I was able to resolve this by embedding a CAST(expression as varchar(max)) in my sql query and then run the query via automation test in visual studio.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.