У меня есть несколько полей в db с типом money, а в C # я использовал для них десятичную. Я сравниваю значения в C # cоде так:
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 && DbValues != null) && (currentValues[currentPropertyName].ToString() != DbValues[DBPropertyName].ToString()))
{
result += string.Format("Property{0}, {1} = {2}, {3} <br />", currentPropertyName, DbValues[DBPropertyName], currentValues[currentPropertyName], DBPropertyName);
}
}
}
}
return result;
}
но оно не совпадает из-за количества нулей / точности:
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
Как это исправить?