title: Temporary tables how to create before transaction and then use inside transaction
body: <p>I write code in c#. </p>
  
  <p>I want to create temporary table before transaction begins and then use it within transaction, however when I try to do it I get error within transaction it estates that "Table does not exist". What is the proper way of doing it ?</p>
  
  <pre><code>SqlConnection sqlConnection = new SqlConnection( "connstring" );
  sqlConnection.Open();
  
  string temp = string.Format( "CREATE TABLE dbo.#temp (id INT);" );
  DbCommand command = database.GetSqlStringCommand( temp );
  database.ExecuteNonQuery( command ); //here is the problem when I add argument , transaction it works
  //fill data in temporary table
  //...
  // open transaction
  SqlTransaction transaction = sqlConnection.BeginTransaction();
  
  //Here I try to read from temp table I have some DbCommand readCommand
  database.ExecuteNonQuery( readCommand, transaction ); 
  </code></pre>