title: C#, Can I INSERT and DELETE from SQL Server table while reading it
body: <p>Everything is quite in the title.</p>
  
  <p>I'm reading the result of a <code>SqlCommand</code> (which is a join query of table1 and table2).</p>
  
  <pre><code>   using (SqlCommand cmd = new SqlCommand(sqlCommand, eve.Database))
     {
          using (SqlDataReader sdr = cmd.ExecuteReader())
          {
              //Performing some tasks
          }
     } 
  </code></pre>
  
  <p>Actually in the "performing some tasks" part, I do some <code>INSERT</code> and <code>DELETE</code> on one of my join table (we will talk about table1 for example).</p>
  
  <p>I'm currently intern in a company, the code is working well on small amount of data but my tutor is telling me that this is not a good idea because I may have some problems of reading and writing in my table because of SQL Server locks.</p>
  
  <p>I would add that to trigger my INSERT and DELETE, I'm just opening a new connection (so I'm not using the main one) and I'm executing the <code>ExecuteNonQuery()</code> call.</p>
  
  <pre><code>using (SqlConnection cnx = Piivo.Utils.Open(Configuration))
  {
       SqlCommand cmd = new SqlCommand(command, cnx);
       cmd.ExecuteNonQuery();
  }
  </code></pre>