Copy one datatable to another datatable in asp.net
<p>I have created a <code>datatable</code> which has some records, now what I want is to copy the record of first <code>datatable</code> to another <code>datatable</code>.</p>

<p>I tried like below:</p>

<pre><code>Session["AmountData"] = AmountDatatable; // 1st datatable which has data

DataTable CompanyWiseRecord = new DataTable();
for (int i = 0; i &lt; AmountDatatable.Rows.Count; i++)
{
   CompanyWiseRecord.ImportRow(AmountDatatable.Rows[i]); // 2nd datatable which does not have data
}
</code></pre>

<p>Kindly let me know where I am going wrong.</p>