0

I need to send the time of day to the API but TimeOfDay does not result right response (API returns null). If I set the time manually (commented in code) its working fine. Debug watch shows similar format as manual writting. What is the issue here?

enter image description here

Any workaround?

PCG
  • 2,049
  • 5
  • 24
  • 42
  • [Avoid posting pictures of code](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question/285557#285557) – Richardissimo Nov 11 '18 at 08:48
  • 1
    Unrelated tips: you may want to read [Can we stop using AddWithValue](https://blogs.msmvps.com/jcoehoorn/blog/2014/05/12/can-we-stop-using-addwithvalue-already/). The command is IDisposable so should be in a `using` block. Actually, that first tip might be the answer. – Richardissimo Nov 11 '18 at 08:49
  • Another unrelated tip: for parameter 7 you take an enum value, convert it to a string, parse it back into a typed enum value of the same type. Why not just pass the enum value as the parameter? – Richardissimo Nov 12 '18 at 06:17
  • Is the query that it calls under your control? If so, why not use Parameter5 instead of 3 and 4. (And consider giving the parameters meaningful names while you're at it.) – Richardissimo Nov 12 '18 at 06:19
  • *"Debug watch shows similar format as manual writing."* Consider that the debugger has to turn everything into a string to show it to you in the watch window; but that doesn't mean you can use a string instead of it. There is another column in the debug windows which shows the type of the thing it is showing you... **that** is what you should be paying attention to, if you are trying to supply that value yourself. – Richardissimo Nov 12 '18 at 06:26

0 Answers0