在单个数据表中合并2个数据表 [英] merge 2 datatable in single datatable

查看:77
本文介绍了在单个数据表中合并2个数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个数据表,每个数据表包含100个数据行.在这两个数据表中,共有20行(在两个数据表中都存在).当我合并这两个数据表时,如何删除重复的数据行而不影响性能,因为将来数据表中的数据行可能会增加.

在此先感谢

I have 2 datatables each containing 100 datarows each. in these 2 datatables 20 rows are common (exist in both data tables). When i merge these 2 datatables how i can eleminate the duplicate datarows without effecting the performance because the datarows in the datatables might increase in future.

thanks in advance

推荐答案

^ ]

通过消除重复的行来合并两个数据表 [ ^ ]

如何从数据表中删除重复的行.... [
Merging two DataSets eliminating the duplicate rows[^]

Merge two DataTables by eliminating duplicate rows[^]

How to remove duplicate rows from a DataTable....[^]


尝试这样
DataSet ds = new DataSet();
ds.Tables.Add(Table1);
ds.Tables.Add(Table2);
ds.Relations.Add("TheRelation",Table1.Columns ["a"],Table2.Columns ["a"]);
Table2.Columns.Add("b",GetType(System.String),"Parent.b")

并查看下面的链接,您可能会有一个主意
http://stackoverflow.com/questions/1262383/merging-2-data- tables-in-vb-net [ ^ ]
try like this
DataSet ds=new DataSet();
ds.Tables.Add(Table1);
ds.Tables.Add(Table2);
ds.Relations.Add("TheRelation", Table1.Columns["a"], Table2.Columns["a"]);
Table2.Columns.Add("b", GetType(System.String), "Parent.b")

and see below link you may get an idea
http://stackoverflow.com/questions/1262383/merging-2-data-tables-in-vb-net[^]


这篇关于在单个数据表中合并2个数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆