0

Database is MSSQL and project is ASP.NET MVC Core

I have a database which is filled with balls. Each ball has properties like size and weight. The weight property is a decimal value. I made a model called 'Ball' and added the properties to it. I used the scaffolding function in Visual Studio to generate a controller with views. I linked the database and it all works!

The issue is, when adding a ball to the list, I cant add a comma to the decimal value. I can add a dot to the number, but this doesnt get saved as a decimal.

When I enter 4.56 in the textbox the database saves it as 456,00.

How can I fix this issue. I think I have to change the validation, but I am not sure where, since Im new to this.

Thanks in advance!

  • 2
    This *sounds* like you are passing your parameters as strings not as decimal values. Regardless of the language setting, `4.56` is interpreted by T-SQL as "Four point five six". – Thom A Sep 06 '21 at 14:11
  • Would be good to see the database schema as that sounds a bit confusing. if you enter 4.56 then it will save it as that if it is a decimal – Andrew Sep 06 '21 at 15:33

0 Answers0