Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 25, 2012 08:08 AM by Abu Hurayra
Member
4 Points
6 Posts
Apr 24, 2012 08:57 PM|LINK
I have a Dataset Ds1 and dataset Ds2 , DS1 has Product_ID, product information and ds2 has Product_ID, product_type.
for the matching product_id, I want to add the Product_tye column from ds2 to ds1 .
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.
All-Star
118619 Points
18779 Posts
Apr 26, 2012 01:50 AM|LINK
yuvaratna I have a Dataset Ds1 and dataset Ds2 , DS1 has Product_ID, product information and ds2 has Product_ID, product_type.
Sorry maybe it's DataTable instead of DataSet——For DataSet is a container that holds DataTables……
yuvaratna for the matching product_id, I want to add the Product_tye column from ds2 to ds1 .
Not understand what you mean……Please show us your two tables' values and structures and what you want to gain in the end?
Reguards!
17 Points
4 Posts
Jul 25, 2012 08:08 AM|LINK
Hi, You can use,
DataTable mytbl = new DataTable("Table1"); mytbl.Merge(ds.Tables[0], true);
ds2.Tables.Add(mytbl);
or
ds1.Tables.Add( ds2Table.Copy() );
dataset DataTable MERGE
yuvaratna
Member
4 Points
6 Posts
adding column from a dataset to another dataset
Apr 24, 2012 08:57 PM|LINK
I have a Dataset Ds1 and dataset Ds2 , DS1 has Product_ID, product information and ds2 has Product_ID, product_type.
for the matching product_id, I want to add the Product_tye column from ds2 to ds1 .
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.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: adding column from a dataset to another dataset
Apr 26, 2012 01:50 AM|LINK
Sorry maybe it's DataTable instead of DataSet——For DataSet is a container that holds DataTables……
Not understand what you mean……Please show us your two tables' values and structures and what you want to gain in the end?
Reguards!
Abu Hurayra
Member
17 Points
4 Posts
Re: adding column from a dataset to another dataset
Jul 25, 2012 08:08 AM|LINK
Hi, You can use,
DataTable mytbl = new DataTable("Table1"); mytbl.Merge(ds.Tables[0], true);or
dataset DataTable MERGE
Please Mark As Answer, if this helps you