title: comparing money in sql server with decimal in C#
body: <p>I have some fields in db with type money and in C# I have used decimal for them. I am comparing values in C# c ode like this:</p>
  
  <pre><code>public static string CompareValues(DbPropertyValues currentValues, DbPropertyValues DbValues)
          {
              string result = string.Empty;
  
              foreach (var currentPropertyName in currentValues.PropertyNames)
              {
                  foreach (var DBPropertyName in DbValues.PropertyNames)
                  {
                      if (DBPropertyName == "PropertyCreditLimit" || DBPropertyName == "PropertyCreditLimit" || DBPropertyName == "PropertyCreditLimit" || DBPropertyName == "PropertyCreditLimit" || DBPropertyName == "PropertyCreditLimit")
  
  
                      if ((currentPropertyName == DBPropertyName))
                      {
                          if (( currentValues[currentPropertyName] != null &amp;&amp; DbValues != null) &amp;&amp;  (currentValues[currentPropertyName].ToString() != DbValues[DBPropertyName].ToString()))
                          {
                              result += string.Format("Property{0}, {1} =  {2}, {3} &lt;br /&gt;", currentPropertyName, DbValues[DBPropertyName], currentValues[currentPropertyName], DBPropertyName);
                          }
                      }
                  }
              }
  
              return result;
          }
  </code></pre>
  
  <p>but it is not matching due to number of zeros/precision:</p>
  
  <pre><code>PropertyDateFirstReported, 3/8/2008 1:15:36 AM = 1/1/0001 12:00:00 AM, DateFirstReported 
  PropertyCreditLimit, 564000.0000 = 564000.00, CreditLimit 
  PropertyBalance, 45.0000 = 45.00, Balance 
  PropertyMinimumInstallment, 0.0000 = 0.00, MinimumInstallment 
  PropertyTerm, = Term1, Term 
  PropertyPurpose, a = a1, Purpose 
  PropertyCollateralValue, 0.0000 = 0.00, CollateralValue 
  PropertyAccountUniqueID, 3767 = 0, AccountUniqueID 
  PropertyPayment, 564000.0000 = 564000.00, Payment
  </code></pre>
  
  <p>How to fix this ?</p>