title: Stupid problem with ASP.NET GridView + DataSource + SQLDataReader
body: <p>I've been through oh so many tutorials and I just can't get this right. I'm trying to populate a gridview based on the results of a stored procedure. I'm probably code blind by now but I really tried to make sure I didn't mess up on something small. </p>
  
  <p>This is the stored procedure: </p>
  
  <pre><code>ALTER PROCEDURE dbo.GetAllPlayersFromGame
  
  (
  @gameID int
  )AS
  /* SELECT all the players within a game */
  
  SELECT playerName FROM Player WHERE gameID = @gameID
  </code></pre>
  
  <p>This is the code I use to create a datatable which I then use as the datasource for the gridview:</p>
  
  <pre><code>        public static DataTable PopulateGridView(string resultSetQuery)
      {
          //Populate gridview
          OpenConnection();
          SqlCommand sqlCommand = new SqlCommand(resultSetQuery, _sqlConnection);
  
          SqlDataReader reader = sqlCommand.ExecuteReader();
  
          DataTable dataTable = new DataTable();
          dataTable.Load(reader);
          return dataTable;
      }
  </code></pre>
  
  <p>And this is the method that calls everything and is supposed to populate the gridview: </p>
  
  <pre><code>protected void ShowPlayersInGame()
  {
  
      GridViewShowPlayersInGame.DataSource = CreateDatabaseConnection.PopulateGridView("EXEC GetAllPlayersFromGame " + _gameId);
      GridViewShowPlayersInGame.DataBind();
  }
  </code></pre>
  
  <p>When I debug I see all the data in the reader object so the stored procedure works. But something happens when it gets to ShowPlayersInGame because the gridview won't take the data. I've probably missed something rudimentary since I haven't used gridviews a lot before. </p>
  
  <p>Any ideas?</p>