I am using Microsoft SQL Server Management Studio and C# to insert some rows into this database. The first column of this table is a code (type varchar(20)
) and the second one is a float
. The problem arises because if I want to enter 3,71, the database stores 3,7100000381469727.
Code:
float superficieL = float.Parse(row.Cells[indexSuperficie].Value.ToString(), new CultureInfo("es-ES"));
The value inserted in the database as a float is this variable, and I get his value from a datagridview that only contains 3,71.
More examples:
- (DB)001122 - 0,9100000262260437
- (DB)335T1613 - 0,5
- (DB)335T1642 - 3,869999885559082
- (DB)335T1644 - 3,7100000381469727
Why is this happening?