How to merge multiple dataviews into one?

Prabhu picture Prabhu · Sep 30, 2011 · Viewed 7.6k times · Source

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?

Answer

Dennis Traub picture Dennis Traub · Sep 30, 2011
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)