title: DataTable From Session Memory has No Columns
body: <p>Im trying to retrieve a datatable that I put into a session variable, however when i do it apears that there are no columns...</p>
  
  <p>I have done this before in VB.NET, I'n now using C#, and it worked perfectly, and as far as i can see there is no change in the code other than the obvious syntax changes.</p>
  
  <p>EDIT:</p>
  
  <p>The dt (in part 2) variable has the right data when i look in the data visulization window, but i have noticed that the other properties associated with a datatable are abscent. When i hover over a normal looking datatable with my mouse it looks like the following: " dt ----- {System.Data.DataTable}" but in the class im working on it just looks like "dt ----- {}".  Also, after I return the session variable into the dt I clone it (dtclone = dt.clone(); ) and the clone is empty in the data visulizer.... what on earth! </p>
  
  <p>EDIT 2: </p>
  
  <p>I have now also tried converting the first datatable to a dataset, putting this in the session variable, and recoverting it back to a datatable in the class.</p>
  
  <p>Am starting to wonder if it is a probelm with:</p>
  
  <pre><code>    dt.Load(sqlReader);
  </code></pre>
  
  <p>The data does appear after this step though in the dataset visualiser, but not after being cloned.</p>
  
  <p>Code below.</p>
  
  <p>All help very welcome!</p>
  
  <p>Thanks in advance</p>
  
  <p>Chris</p>
  
  <p>1) SQL command in a webhandler, the results of which populate the datatable to be put into the session variable.</p>
  
  <pre><code>    DataTable dt = new DataTable();
  
      SqlDataReader sqlReader= default(SqlDataReader);        
      SqlDataAdapter sqlAdapter = new SqlDataAdapter();
  
      sqlReader = storedProc.ExecuteReader(CommandBehavior.CloseConnection);
  
      dt.Load(sqlReader);
      System.Web.HttpContext.Current.Session["ResultsTable"] = dt;
  </code></pre>
  
  <p>2) Part of the code in a class which performs calculations on the table:</p>
  
  <pre><code>    DataTable dt = (DataTable)HttpContext.Current.Session["ResultsTable"]; 
  </code></pre>