C# DateTime to SQL DateTime losing precision
<p>Have a small problem where if I save a DateTime field as an SQL command parameter it loses precision, like often less than a milisecond.</p>

<p>e.g. The parameter's <code>Value</code> is:
<code>TimeOfDay  {16:59:35.4002017}</code></p>

<p>But its <code>SqlValue</code> is:
<code>TimeOfDay  {16:59:35.4000000}</code>
And that's the time that's saved in the database.</p>

<p>Now I'm not particularly bothered about a couple of microseconds, but it causes problems later on when I'm comparing values, they show up as not equal. 
(Also in some comparisons the type of the field is not known until run-time so I'm not even sure at dev-time whether I'll even need special DateTime "rounding" logic)</p>

<p>Is there any easy fix for this when adding the parameter?</p>