【解決方法】C# で 2 つのデータテーブルを比較する

プログラミングQA


I have two datatables and i need to compare two datatables values then getting the reult.
Case1:In both datatable values are not matching then merge two datatable results into Datatable3.

Datatable 1				Datatable2	
ID   Column2			ID     Column2
1	Test1                3      Test3
2   Test2                4      Test4

Here we need to compare two datatble ID's then if both are not matching then we need to merge the results like below
Datatable3 
ID  Column2
1    Test1
2    Test2
3    Test3
4    Test4


Case2:
If any value is matching those record not inserted into datatable.The result like below Datatable3.
Datatable 1				Datatable2	
ID   Column2			ID     Column2
1	Test1                3      Test3
2   Test2                5       Test5
3   Test3
4   Test4 

Datatable3
ID   Column2
1     Test1
2     Test2 
3     Test3
4     Test4
5      Test5 

誰でも私を助けてください。

私が試したこと:

非常に多くのシナリオを試しましたが、うまくいきませんでした。

解決策 1

簡単なグーグル検索を行いました: c# 2 つのデータテーブルを比較する[^] 最初に見つかった結果: 2 つの dataTable を比較する方法[^] いくつかの解決策から選択できます。

コメント

タイトルとURLをコピーしました