在 C# 中合并两个数据表
我有两个数据表,如下
Table1
--------------------------------
Id | Batch | Qty
-----------------------------
1 A1 5
2 A2 5
3 A3 5
4 A4 5
Table2
--------------------------------
Id | Batch | Qty
-----------------------------
1 A1 6
2 A2 6
3 A3 6
5 A5 10
Expected result
--------------------------------
Id | Batch | Qty
-----------------------------
1 A1 6 (Qty updated)
2 A2 6 (Qty updated)
3 A3 6 (Qty updated)
4 A4 5 (remains as same)
5 A5 10 (row in table 2)
我如何在 C# 中实现这一点。如果有人知道这个数据表操作请分享..
I Have two datatables as follows
Table1
--------------------------------
Id | Batch | Qty
-----------------------------
1 A1 5
2 A2 5
3 A3 5
4 A4 5
Table2
--------------------------------
Id | Batch | Qty
-----------------------------
1 A1 6
2 A2 6
3 A3 6
5 A5 10
Expected result
--------------------------------
Id | Batch | Qty
-----------------------------
1 A1 6 (Qty updated)
2 A2 6 (Qty updated)
3 A3 6 (Qty updated)
4 A4 5 (remains as same)
5 A5 10 (row in table 2)
How can i achieve this in c#. If anybody knows this data table operation please share..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这样的事情,这是一个如何合并两个数据表的示例......
try something like this, this is an example how to merge two datatables...