I am doing below code in c#
obj.value = decimal_value / 100;
Where obj.value
is a decimal
variable in the model
decimal_value
is a variable holding a decimal
value
C# code
if (member["LOADINGS"] != "")
{
decimal loading_temp = Convert.ToDecimal(member["LOADINGS"]);
prem.loadings = loading_temp / 100m;
}
When debugged prem.loading
gets correct value 0.0952
but when it get saved in sql server it shows 0.09000
loading variable in model
public decimal? loadings {get;set;}
eg: result
9.52/100
gives 0.0952
but when it stores in sql server in a column of datatype decimal(18,5)
it gives the result 0.0900
Any idea for this ?
Edit
saving in database
premium prem = new premium();
if (member["LOADINGS"] != "")
{
decimal loading_temp = Convert.ToDecimal(member["LOADINGS"]);
prem.loadings = loading_temp / 100m;
}
db.premium.add(prem);
db.savechanges();