Ошибка - в позиции 35 нет строки.
error- There is no row at position 35.
Что я уже пробовал:
try { DataTable dt = new DataTable(); //string str = "select round(Avg(Score),2) as Score from oeunitscore"; string str = @"select om.unitgroup, round(Avg(Score),2) as Score, date(timestamp) as TimeStamp from oeunitscore os, oeunitmaster om where os.unitcode=om.unitcode and date(timestamp) BETWEEN SYSDATE() - interval 11 day AND SYSDATE() group by unitgroup, date(timestamp) order by date(timestamp) , unitgroup asc"; if (con.State == ConnectionState.Closed) { con.Open(); } MySqlDataAdapter da = new MySqlDataAdapter(str, con); da.Fill(dt); if (dt.Rows.Count > 0) { date1 = Convert.ToDateTime(dt.Rows[0]["TimeStamp"]).ToString("dd-MM-yy"); date2 = Convert.ToDateTime(dt.Rows[7]["TimeStamp"]).ToString("dd-MM-yy"); date3 = Convert.ToDateTime(dt.Rows[14]["TimeStamp"]).ToString("dd-MM-yy"); date4 = Convert.ToDateTime(dt.Rows[21]["TimeStamp"]).ToString("dd-MM-yy"); date5 = Convert.ToDateTime(dt.Rows[28]["TimeStamp"]).ToString("dd-MM-yy"); date6 = Convert.ToDateTime(dt.Rows[35]["TimeStamp"]).ToString("dd-MM-yy"); date7 = Convert.ToDateTime(dt.Rows[42]["TimeStamp"]).ToString("dd-MM-yy"); dh1 = Convert.ToSingle(dt.Rows[0]["Score"].ToString()); di1 = Convert.ToSingle(dt.Rows[1]["Score"].ToString()); fr1 = Convert.ToSingle(dt.Rows[2]["Score"].ToString()); gf1 = Convert.ToSingle(dt.Rows[3]["Score"].ToString()); lr1 = Convert.ToSingle(dt.Rows[4]["Score"].ToString()); of1 = Convert.ToSingle(dt.Rows[5]["Score"].ToString()); ut1 = Convert.ToSingle(dt.Rows[6]["Score"].ToString()); dh2 = Convert.ToSingle(dt.Rows[7]["Score"].ToString()); di2 = Convert.ToSingle(dt.Rows[8]["Score"].ToString()); fr2 = Convert.ToSingle(dt.Rows[9]["Score"].ToString()); gf2 = Convert.ToSingle(dt.Rows[10]["Score"].ToString()); lr2 = Convert.ToSingle(dt.Rows[11]["Score"].ToString()); of2 = Convert.ToSingle(dt.Rows[12]["Score"].ToString()); ut2 = Convert.ToSingle(dt.Rows[13]["Score"].ToString()); dh3 = Convert.ToSingle(dt.Rows[14]["Score"].ToString()); di3 = Convert.ToSingle(dt.Rows[15]["Score"].ToString()); fr3 = Convert.ToSingle(dt.Rows[16]["Score"].ToString()); gf3 = Convert.ToSingle(dt.Rows[17]["Score"].ToString()); lr3 = Convert.ToSingle(dt.Rows[18]["Score"].ToString()); of3 = Convert.ToSingle(dt.Rows[19]["Score"].ToString()); ut3 = Convert.ToSingle(dt.Rows[20]["Score"].ToString()); dh4 = Convert.ToSingle(dt.Rows[21]["Score"].ToString()); di4 = Convert.ToSingle(dt.Rows[22]["Score"].ToString()); fr4 = Convert.ToSingle(dt.Rows[23]["Score"].ToString()); gf4 = Convert.ToSingle(dt.Rows[24]["Score"].ToString()); lr4 = Convert.ToSingle(dt.Rows[25]["Score"].ToString()); of4 = Convert.ToSingle(dt.Rows[26]["Score"].ToString()); ut4 = Convert.ToSingle(dt.Rows[27]["Score"].ToString()); dh5 = Convert.ToSingle(dt.Rows[28]["Score"].ToString()); di5 = Convert.ToSingle(dt.Rows[29]["Score"].ToString()); fr5 = Convert.ToSingle(dt.Rows[30]["Score"].ToString()); gf5 = Convert.ToSingle(dt.Rows[31]["Score"].ToString()); lr5 = Convert.ToSingle(dt.Rows[32]["Score"].ToString()); of5 = Convert.ToSingle(dt.Rows[33]["Score"].ToString()); ut5 = Convert.ToSingle(dt.Rows[34]["Score"].ToString()); dh6 = Convert.ToSingle(dt.Rows[35]["Score"].ToString()); di6 = Convert.ToSingle(dt.Rows[36]["Score"].ToString()); fr6 = Convert.ToSingle(dt.Rows[37]["Score"].ToString()); gf6 = Convert.ToSingle(dt.Rows[38]["Score"].ToString()); lr6 = Convert.ToSingle(dt.Rows[39]["Score"].ToString()); of6 = Convert.ToSingle(dt.Rows[40]["Score"].ToString());
Herman<T>.Instance
В вашей таблице меньше 35 строк. Это то, что я вам говорю.