for example inserting (0.1234) by the manual query is fine but while using the mvc5 form to insert the value from the form.
1- configurations of column in database is :
RateBuy (decimal(18, 4))
2- the model is setup like , while inserting the data from the from
[DisplayFormat(DataFormatString = "{0:n4}", ApplyFormatInEditMode = true)]
public decimal RateBuy { get; set; }
result is 0.1200 in the database
3- the model is setup like, while inserting the data from the from
[DisplayFormat(DataFormatString = "{0:0.0000}", ApplyFormatInEditMode = true)]
result is 0.1200 in the database
Code to save data :
public ActionResult SaveNew(Rate tbl)
{
Rate t = new Rate ();
t.RateBuy = tbl.RateBuy;
dbConnection.Entry(t).State = System.Data.Entity.EntityState.Added;
dbConnection.SaveChanges();
return View();
}
any solution a big head ache...