title: C# multiple parallel inserts in database
body: <p>I have a datatable with around 3000 rows. Each of those rows need to be inserted in a database table. Currently, i am running a foreach loop as under:</p>
  
  <pre><code>obj_AseCommand.CommandText = sql_proc;
  obj_AseCommand.CommandType = CommandType.StoredProcedure;
  obj_AseCommand.Connection = db_Conn;
  obj_AseCommand.Connection.Open();
  
  foreach (DataRow dr in dt.Rows)                
  {
      obj_AseCommand.Parameters.AddWithValue("@a", dr["a"]);
      obj_AseCommand.Parameters.AddWithValue("@b", dr["b"]);
      obj_AseCommand.Parameters.AddWithValue("@c", dr["c"]);
  
      obj_AseCommand.ExecuteNonQuery();
      obj_AseCommand.Parameters.Clear();
  }
  
  obj_AseCommand.Connection.Close();
  </code></pre>
  
  <p>Can you please advise how can I do parallelly execute the SP in database since the above approach takes about 10 minutes to insert 3000 rows.</p>