I have three dataviews (dataview1, dataview2, and dataview3). These are of type System.Data.DataView, and all three have the same columns. Is there an easy way to merge them into one, so I have one dataview with rows from dataview1, followed by dataview2, and then dataview3?
Asked
Active
Viewed 9,097 times
2 Answers
11
Dim dataview1 As DataView = new DataView()
Dim dataview2 As DataView = new DataView()
'' given the tables are not null you can then merge like this
dataview1.Table.Merge(dataview2.Table)

Dennis Traub
- 50,557
- 7
- 93
- 108
-
Thanks, I guess I somehow missed that! – Prabhu Sep 30 '11 at 17:59
-
1Please flag as "Answered" if this is what you were looking for. Thanks :) – Hanlet Escaño Sep 30 '11 at 18:04
-
Afaik this will not really merge the DataViews but the underlying Tables, ie all RowFilters will be ignored. – TaW May 03 '18 at 08:04
3
DataTable datatableMerge = dataview1.ToTable();
datatableMerge.Merge(dataview2.ToTable());
The result includes only the rows according to the the DataViews' Filters.