Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends...!

I have two datasets which are identical with only one field having a value zero in first dataset and 1 in second dataset.

say ds1 contains col1 which have all values 0 and
ds2 contains column which have all values 1 with other columns same

now i want to create a 3rd dataset in which rows hving values 1 and 0 appear alternately such as


1
0
1
0
...

does anyone know a solution?
Posted
Updated 31-Dec-09 0:01am
v3

DS1.Merge(DS2);
DS1.AcceptChanges();
 
Share this answer
 
Hi,

Are you referring to a ado.net dataset? If so I assume you have a datatable in the datasets with identical column definitions. Do you want to merge the tables into 1 table with all the data?

Datatables have no inherent order, they are collections of rows,
although the rows usually are in the order they are added to the datatable. You could ensure a particualar order in the merged table by adding each row from the 2 tables one at a time in the correct order.

If you are displaying the data in some sort of control (web, winforms?) then the control would have some way of ordering the rows displayed, usually thru the controls datasource.

I hope this is useful. Good Luck
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900