Incluyo la consulta mencionada y la linea donde genera el error es """MySqlDataReader hist = histoform.ExecuteReader();"
MySqlCommand/*HISTORIAL histoformFORMULA*/
string val = "", valu="";
int exitval = 0;
MySqlCommand histoform = new MySqlCommand("SELECT EVTTIME,
SUM(DISTINCT CASE WHEN c.H_MNEMO = 'SET_CEMENTO' THEN ROUND(d.evtvalue) END) AS CEM,
SUM(DISTINCT CASE WHEN c.H_MNEMO = 'SET_CARBONATO' THEN ROUND(d.evtvalue) END) AS CAR,
SUM(DISTINCT CASE WHEN c.H_MNEMO = 'SK_SETCELULOSAVIRGEN' THEN ROUND(d.evtvalue) END) AS CVIR,
SUM(DISTINCT CASE WHEN c.H_MNEMO = 'SK_SETCELULOSADKL' THEN ROUND(d.evtvalue) END) AS CDKL,
SUM(DISTINCT CASE WHEN c.H_MNEMO = 'SK_SETPVA' THEN ROUND(d.evtvalue) END) AS PVA,
SUM(DISTINCT CASE WHEN c.H_MNEMO = 'SK_SETHIDROFUGANTE' THEN ROUND(d.evtvalue) END) AS HID,
SUM(DISTINCT CASE WHEN c.H_MNEMO = 'SET_LODO' THEN ROUND(d.evtvalue) END) AS LOD,
SUM(DISTINCT CASE WHEN c.H_MNEMO = 'SET_FILLER' THEN ROUND(d.evtvalue) END) AS FIB,
SUM(DISTINCT CASE WHEN c.H_MNEMO = 'SET_CELULOSA' THEN ROUND(d.evtvalue) END) AS DCEL,
SUM(DISTINCT CASE WHEN c.H_MNEMO = 'SK_SETFORMULAOTROS' THEN ROUND(d.evtvalue) END) AS OTR,
SUM(DISTINCT CASE WHEN c.H_MNEMO = 'SK_VALCODIGOFORMULMATPRIM' THEN ROUND(d.evtvalue) END) AS FORM
FROM DATOSDT D,
configuration c
WHERE c.evtcellule = d.evtcellule
AND EVTTIME BETWEEN '" + fecinic + "'
AND '" + fecfinc + "'
GROUP BY d.EVTTIME
HAVING FORM IS NOT NULL
ORDER BY d.EVTTIME DESC;", con.conected());
MySqlDataReader hist = histoform.ExecuteReader();
if (hist.HasRows)
{
while (hist.Read())
{
if (hist[1].ToString() != "" && hist[2].ToString() != "" && hist[3].ToString() != "" && hist[4].ToString() != "" && hist[5].ToString() != "" && hist[6].ToString() != "" && hist[7].ToString() != "" && hist[8].ToString() != "" && hist[9].ToString() != "" && hist[10].ToString() != "" && hist[11].ToString() != "")
{
if (hist[11].ToString() != "")
{
if (hist[11].ToString() != val)
{
filas = dt.FORMULAHIST.NewRow();
filas["FECHA"] = hist[0].ToString();
filas["CEMENTO"] = hist[1].ToString();
filas["CARBONATO"] = hist[2].ToString();
filas["CELVIRGEN"] = hist[3].ToString();
filas["CELDKL"] = hist[4].ToString();
filas["PVA"] = hist[5].ToString();
filas["HIDRO"] = hist[6].ToString();
filas["LODO"] = hist[7].ToString();
filas["FIBER"] = hist[8].ToString();
filas["DESCCEL"] = hist[9].ToString();
filas["OTRO"] = hist[10].ToString();
filas["CODIGO"] = hist[11].ToString();
dt.FORMULAHIST.Rows.Add(filas);
exitval++;
}
val = hist[11].ToString();
}
}
}
con.CerrarConexion();
}