title: Add new rows to a DataTable programmatically C#
body: <p>I have a DataTable which I fill from a database and the in code behind I am trying to add 3 more rows after each row. Below is the code. But at the 6th line I get</p>
  <blockquote>
  <p>Exception of type 'System.OutOfMemoryException' was thrown.</p>
  </blockquote>
  <pre><code>  for (int i = 0; i &lt; AlldaysList.Rows.Count; i++)
      {
          DataRow row;
          row = AlldaysList.NewRow();
          DataRow row1;
          row1 = AlldaysList.NewRow();
          DataRow row2;
          row2 = AlldaysList.NewRow();
  
          // Then add the new row to the collection.
          row[&quot;scenarionid&quot;] = DBNull.Value;
          row[&quot;description&quot;] = &quot;&quot;;
          row1[&quot;scenarionid&quot;] = DBNull.Value;
          row1[&quot;description&quot;] = &quot;&quot;;
          row2[&quot;scenarionid&quot;] = DBNull.Value;
          row2[&quot;description&quot;] = &quot;&quot;;
          AlldaysList.Rows.InsertAt(row, i + 1);
          AlldaysList.Rows.InsertAt(row1, i + 2);
          AlldaysList.Rows.InsertAt(row2, i + 3);
          i++;
      }
  </code></pre>