adding column from a dataset to another datasethttp://forums.asp.net/t/1796556.aspx/1?adding+column+from+a+dataset+to+another+datasetWed, 25 Jul 2012 08:08:42 -040017965564949459http://forums.asp.net/p/1796556/4949459.aspx/1?adding+column+from+a+dataset+to+another+datasetadding column from a dataset to another dataset <p>I have a Dataset Ds1 and dataset Ds2 , DS1 has Product_ID, product information and ds2 has Product_ID, product_type.</p> <p></p> <p>for the matching product_id, I want to add the Product_tye column from ds2 to ds1 .</p> <p></p> <p>Note: Product_id is not primary key in ds 1, the result set has many products with same product_id. In ds 2, product_id is unique.</p> <p></p> <p></p> 2012-04-24T20:57:39-04:004951741http://forums.asp.net/p/1796556/4951741.aspx/1?Re+adding+column+from+a+dataset+to+another+datasetRe: adding column from a dataset to another dataset <p></p> <blockquote><span class="icon-blockquote"></span> <h4>yuvaratna</h4> I have a Dataset Ds1 and dataset Ds2 , DS1 has Product_ID, product information and ds2 has Product_ID, product_type.</blockquote> <p></p> <p>Sorry maybe it's DataTable instead of DataSetFor DataSet is a container that holds DataTables</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>yuvaratna</h4> for the matching product_id, I want to add the Product_tye column from ds2 to ds1 .</blockquote> <p></p> <p>Not understand what you meanPlease show us your two tables' values and structures and what you want to gain in the end</p> <p>Reguards</p> 2012-04-26T01:50:39-04:005081104http://forums.asp.net/p/1796556/5081104.aspx/1?Re+adding+column+from+a+dataset+to+another+datasetRe: adding column from a dataset to another dataset <p>Hi, You can use,</p> <pre class="prettyprint">DataTable mytbl = new DataTable(&quot;Table1&quot;); mytbl.Merge(ds.Tables[0], true);</pre> <pre class="prettyprint">ds2.Tables.Add(mytbl);</pre> <p><br />or</p> <pre class="prettyprint">ds1.Tables.Add( ds2Table.Copy() );</pre> <p><br> <br> </p> 2012-07-25T08:08:42-04:00