3
The specified conversion error is not valid happens in the code:
if (command.ExecuteScalar() == DBNull.Value)
{
resultados[j2][i2] = 0;
}
else
{
resultados[j2][i2] = (double)(decimal)command.ExecuteScalar(); /* <<---- */
}
The query I’m running in mysql is:
SELECT IFNULL(AVG(VL_M4000010),0)
FROM HT_MA4_ESS_SEG
WHERE YEAR(TS_SAMPLETM) = 2015
AND MONTH(TS_SAMPLETM) = 1
AND TIME(TS_SAMPLETM)
BETWEEN '00:00:00' AND '00:15:00'
The result of query via Mysql Workbench is 0
.
I’ve tried the conversion without the (decimal)
only with the (double)
, so that would be (double)command.ExecuteScalar();
.
Perfect, it worked! Thank you very much!
– Rafael