开发者

How to merge multiple dataviews into one?

开发者 https://www.devze.com 2023-04-09 09:48 出处:网络
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 da

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 datavie开发者_运维百科w with rows from dataview1, followed by dataview2, and then dataview3?


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)


DataTable datatableMerge = dataview1.ToTable();
datatableMerge.Merge(dataview2.ToTable());

The result includes only the rows according to the the DataViews' Filters.

0

精彩评论

暂无评论...
验证码 换一张
取 消