Convert .net decimal to tsql decimal (3.3)

I have a stored procedure that gets the decimal value (3.3) as a parameter. So, when I try to pass this parameter like this

new SqlParameter { ParameterName = "@Wear", SqlDbType = SqlDbType.Decimal, Value = wear.WearValue } 

I get

Error converting data types from numeric to decimal.

This exception occurs when I try to pass a value of 1.0. I need to convert 1.0 exactly to decimal(3,3) . How can i do this?

+4
source share
1 answer

The maximum decimal(3,3) value decimal(3,3) will be 0.999 , so when you try to insert something more than this exception. try something like decimal(4,3)

+4
source

Source: https://habr.com/ru/post/1491110/


All Articles