I’m having a bit of an issue. I am getting some values from my program’s SQL Server database, doing some calculations with them, and then writing the calculated values back to the database. However, some values are giving me "Error Invalid column name 'NaN'." There really isn’t anything unique about the columns that are causing this issue. They are the same float type columns as the columns that are working perfectly.
con.Open();
AddPhase1Calc = new SqlCommand("UPDATE Asset SET Make_Up_Depr = " + Make_Up_Depr + " WHERE Asset_ID = " + a, con);
AddPhase1Calc.ExecuteNonQuery();
con.Close();
I’m not sure if this is enough code but this is the first column that is causing me the issue.
I’m going to guess Make_Up_Depr is a double and that the calculation is evaluating zero divided by zero in some cases. Which results in the value being NaN, and SQL is trying to evaluate it to a column name/alias (since it’s not a double value…)