title: Create temp table with stored procedure on page load
body: <p>I would like to create a temporary table on either of those events, depending on which would be the most prudent in a real-world application: the page load event, or the second time a button is clicked.   I have a simple stored procedure of</p>
  
  <pre><code>create proc spMakeTempTable
  create table #tempTable (columnName varchar(50))
  </code></pre>
  
  <p>and the c#</p>
  
  <pre><code>   protected void Page_Load(object sender, EventArgs e)
      {
          txtDrugList.Focus();
          string cs = ConfigurationManager.ConnectionStrings["dbcs"].ConnectionString;
          using (var con = new SqlConnection(cs))
          {
              using (var cmd = new SqlCommand("spMakeTempTable", con))
              {
                  con.Open();
                  cmd.CommandType = CommandType.StoredProcedure;
                  cmd.ExecuteNonQuery();
              }
          }
  
      }
  </code></pre>
  
  <p>I need the temp table to be specific to a particular session, so that if different people visited the site a different temp table would be created for them.  When I run the app and the page loads, however, the temporary table isn't created.  If I change the sproc to create a global temporary table, it works.  I don't think that this is what I want, though, since I would like each temporary table to be visitor-specific.  If the visitor refreshes the page it's fine that the temp table will be destroyed and recreated.</p>
  
  <p>Secondly, is it smart to have a proc execute on the page load event, or should I put this logic into a button click event?</p>