将2个数据集合并到1个新数据集中 [英] Merging 2 datasets in 1 new dataset
本文介绍了将2个数据集合并到1个新数据集中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<b></b>i thanks for reading the thread, i am using C#.
I have 2 datasets,& i have to merge them in the 1st one dataset like as
lets say <b>TABLE A</b> has columns name
ID LoanID Firstname lastname
1 1 abc xhs
2 2 ali naeem
3 3 khan rock
4 4 sami rock1
5 5 sameer rock2
6 6 khan1 rock3
<b>TABLE B</b> has columns name
OrgID LoanID Created BY
1 2 abc1
2 2 ali1
3 4 khan21
4 6 sami21
5 6 sameer213
6 6 khan1213
Now the destination <b>TABLE A</b> (if LoanID in the TAbleB then) <b>TABLE C would have column value otherwise no value</b>
ID LoanID Firstname lastname OrgID LoanID CreatedBY
1 1 abc xhs
2 2 ali naeem
3 2 ali naeem 2 2 abc1
4 2 ali naeem 2 2 ali1
5 3 khan rock
6 4 sami rock1
7 4 sami rock1 3 4 khan21
8 5 sameer rock2
now total four rows for loanid=6 and so on
请给我个主意,我是编程新手.
kindly give me idea ,I am new in programming.
推荐答案
您可以使用DataSet.Merge
方法:
http://msdn.microsoft.com/en-us/library/4swwh51k.aspx [ ^ ]
如果这样做,则不会创建第三个数据集.
因此,复制第一个DataSet并将复制的DataSet与第二个DataSet合并:
Hi,
You can use theDataSet.Merge
method:
http://msdn.microsoft.com/en-us/library/4swwh51k.aspx[^]
If you do that, you don''t create a third DataSet.
So, copy the first DataSet and merge the copied DataSet with the second DataSet:
DataSet dataset3 = dataset1.Copy();
// now, merge dataset3 with dataset2, and you'll find the merged result in dataset3
希望这会有所帮助.
Hope this helps.
这篇关于将2个数据集合并到1个新数据集中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文