In my SQL Server
i have a table with a column called FloatValue
With a Float
data type.
I update this value from a WCF
service with this method:
public int UpdateConfig(float value)
{
try
{
using (SqlConnection conn = GetConnection(DbName.Temp))
{
conn.Open();
string command = @"UPDATE ConfigTable SET FloatValue = @value";
using (SqlCommand cmd = new SqlCommand(command, conn))
{
cmd.Parameters.AddWithValue("@value", value);
int res = cmd.ExecuteNonQuery();
return res;
}
}
}
catch (Exception ex)
{
return 0;
}
}
My problem is that when invoking this method like so:
UpdateConfig(1.1);
a select
statement like this:
SELECT ConfigTable.FloatValue From ConfigTable
returns this value: 1.10000002384186
When updating this value directly from SSMS
the correct data is being updated.
How can i solve this?