title: How can I validate that a value passed to a SqlParameter will not fail precision and Scale?
body: <p>How can I validate that a value passed to a SqlParameter will not fail the <strong>Precision</strong> and <strong>Scale</strong> properties <strong>at the time of setting</strong> the value, rather than waiting for the "System.ArgumentException" to be thrown when <strong>ExecuteReader</strong> is called on my command object, so I can throw an <strong>ArgumentoutOfRange</strong> exception earlier in my code and fail fast?</p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>        Decimal myValue = 123456789.234M;
  
          SqlParameter parameter = new SqlParameter("MyParameter", SqlDbType.Decimal);
          parameter.Precision = 10;
          parameter.Scale = 2;
          /* I'd like to fail here at the line below as the value does not conform to precision and scale */
          parameter.Value = myValue; 
  </code></pre>