c# add a DataRow to a table in a separate function
<p>I need to add some "total rows" to a table. The code I am currently using for the sub totals is:</p>

<pre><code>DataRow shRow = ds.Tables[0].NewRow();
shRow["a"] = "SubHead";
shRow["b"] = "Wheel Subs";
shRow["c"] = totalWheels;
</code></pre>

<p>Since I need totals and sub totals and sub sub totals I have to cut and paste this code (changing the values) for each new sub total.</p>

<p>I would like to have a function that takes the current table and values and adds the new row.
Something like:</p>

<pre><code>public DataRow SubRow(DataTable ResultsTable, string SubHead, string SubHeader, string SubHeadValue)
</code></pre>

<p>That would then update the table in the main function. </p>

<p>Thanks for any help.
I just can't 'pass' the table to and from the new function.</p>
