I’m trying to parse a string to float and add it to a SqlParameter.
When I enter 1234567890, it saved in database as 1234567936.
Also I saw it was converted to 1.234568E+9 in debug. Since database accepts float, I can’t convert it into double.
com.Parameters.Add(new SqlParameter("Awb", SqlDbType.Float)).Value = float.Parse(txtAwb.Text);
Solution: Looks like I have to use another data type in database. Float values cannot hold numbers with many digits.
I’m working on an old database, so I will consider something else.
Float values have a limited precision… that is a limited number of significant digits.
If you need to store large values accurately you need to use a different field type in your database. Currency for money or maybe integers for large non-fractional values.
Basically a float cannot hold that large a number to the accuracy you want.