Problem storing decimal values in SQL Server

Asked

Viewed 677 times

3

I have a decimal field (18, 3) and in the application I use a Javascript plugin to format the entered values, so I pass the value so SQL Server 45.000.000.000, when I look at what was registered was that 45000000000.000, ie, he put 3 zeros more, He means it like I haven’t passed the decimal values. I have tried to make the mask in the American standard, and in the Brazilian standard.

What would be the best way to resolve this? How do you do in this situation?

---Edited---

I’m using the Entity framework,

[Required(ErrorMessage = "Campo obrigatório!")]
public decimal VlrObra { get; set; }

Code in data access class

public void Salvar(Obra obra)
{
    db.Obra.Add(obra);
    db.SaveChanges();
}
  • You already tried to send as 45,000,000,000?

  • Yes, he does the same thing. Alias at first was like this, then I switched to the American standard to see if it could be this.

  • What code was used to insert it? Please ask the question?

  • But you said save 45.000.000.000 and when it does SQL appears 45000000000.000. If that is correct, for the return has set the decimals. But if you have 45.000.000, then it’s wrong. Try to send 45.000.000.000,123 and see what comes back.

1 answer

2


Check whether your Web.config has the following statement:

<system.web>
    <globalization culture="pt-BR" uiCulture="pt-BR" />
    ...
</system.web>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.