If I got you correctly, you can just count reader reads like this. Then when the count suits you, you can add something different:
int count = 0; if (dReader.HasRows) { while (dReader.Read()) { if(count == 1) //add special row gameweekList.Text += "something special " + dReader["gameweekID"].ToString(); else gameweekList.Text += "<div class=\"item\"><h4>Gameweek " + (dReader["gameweekID"].ToString()) + "</h4></div>"; count++; } } else { gameweekList.Text = "Error Finding Gameweeks"; } dReader.Close(); conn.Close();
But if you want to have current and subsequent read at the same time you should firs read onceand then start reading in a loop like this:
if (dReader.HasRows) { string previousRead = string.Empty; dReader.Read(); previousRead = dReader["gameweekID"].ToString(); while (dReader.Read()) { //use current and previous read //dReader["gameweekID"].ToString() //previousRead //update previousRead for the next read previousRead = dReader["gameweekID"].ToString(); } } else { gameweekList.Text = "Error Finding Gameweeks"; } dReader.Close(); conn.Close();
if (dreaded[1])would grab the value of the column in the1index. But you're trying to get at a specific row? Are you trying to get at the next row?Read.