3
I’m having a little doubt, I pass a value 0,05 decimal
for a variable A
of the kind string
. After this variable receives this value, it does the conversion of ,
to point .
, which remains 0.05
After I do this replace, I convert the data to the type Decimal
, my variable B
that receives the variable A
stays inteira 5
.
var openingCostValue = Convert.ToDecimal(model.openingCost.Replace(",", "."));
What I want is for you to keep the value that was converted to replace.
Can you put more code? From the beginning where you take the decimal value, you may have an easier way to solve this.
– PauloHDSousa
No need
– Vinícius
So ta, good luck.
– PauloHDSousa
No need to replace, just direct convert. Just be careful with internationalization issues
– Richard Dias
true without replace
– bp002
@Richarddias, the problem if n replaces, the moment it saves in my database, if the value is comma, SQL server leaves the integer value
– Vinícius
Your data type in the database is numeric and in your code is string?
– Richard Dias
Yes, and convert to numeric type and send.
– Vinícius