如何比较两个数据表中的行 [英] How to compare rows from two datatables
本文介绍了如何比较两个数据表中的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是我在VB.NET中获得的两个数据表 - 每个都有100多行。我想比较每行的Qty1和Qty2列中的日期。
如果Qty2(19.5.2015)> Qty1(5.5.2015)然后发送用户电子邮件,否则(Qty2< Qty1)什么都不做。我该怎么做?
Below are two datatables i get in VB.NET - each has 100+ rows. I would like to compare date in columns Qty1 and Qty2 for each rows.
If Qty2 (19.5.2015) > Qty1 (5.5.2015) then send user email, else (Qty2 < Qty1) do nothing. How can i do that?
TABLE 1
MA Qty1
MA31623 19.5.2015 6:17:38
MA11702 11.6.2015 6:01:53
MA05840 22.6.2015 6:16:52
MA05840 22.6.2015 6:16:57
MA05840 22.6.2015 6:17:05
..... .....
TABLE 2
MA Qty2
MA31623 5.5.2015 0:00:00
MA11702 16.3.2015 0:00:00
MA05840 4.6.2015 0:00:00
MA05840 4.6.2015 0:00:00
MA05840 4.6.2015 0:00:00
..... .....
我希望它是写得很清楚,否则我会提供更多信息。
谢谢!
I hope it's written clear enough, otherwise i'll provide more info.
Thanks!
推荐答案
是的,加入两者并检索Qty2
大于Qty1
。
你可以做到通过SQL查询,使用DataTable
比较。
Yes, join both and retrieve the rows whereQty2
is greater thanQty1
.
You can do it by SQL Query else withDataTable
comparisons.
这篇关于如何比较两个数据表中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文