title: An open data reader
body: <p>i recieve this message when i run the action: "There is already an open DataReader associated with this Command which must be closed first."</p>
  
  <p>my code is:public void UpdatePoints(string rightScore, string rightWinner)
      {</p>
  
  <pre><code>    cmd.CommandText = "select * from Users_Details";
      cmd.Connection = connection;
      connection.Open();
      rdr = cmd.ExecuteReader();
  
      while (rdr.Read())
      {
  
          int points=0;
          string sql;
          string hisScore = (string)rdr["lastbetscore"];
          string hisWinner = (string)rdr["lastbetwinner"];
          if (rightScore == hisScore)
              points = points + 30;
          if (rightWinner == hisWinner)
          {
              points = points + 20;
          }
  
          sql = "update Users_Details set lastgame_points='" + points + "', gamesplayed='" + ((int)rdr["gamesplayed"] + 1) + "',currentpoints='" + ((int)rdr["currentpoints"] + points) + "',pointsPG='" + (((int)rdr["currentpoints"] + points) / ((int)rdr["gamesplayed"] + 1)) + "' where username='" + (string)rdr["username"] + "'";
          cmd.CommandText = sql;
          cmd.ExecuteScalar();
      }
      rdr.Close();
      connection.Close();
  }
  </code></pre>