如何比较2个数据表 [英] How to compare 2 dataTables

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

问题描述

我有2个数据表,我只是想知道,如果他们是相同的或没有。由相同的,我的意思是他们有正好与恰好在每列中的数据相同,或不相同的行数。我很想写(查找),它接受两个表,并返回一个布尔值的方法。

I have 2 datatables and I just want to know if they are the same or not. By "the same", I mean do they have exactly the same number of rows with exactly the same data in each column, or not. I'd love to write (find) a method which accepts both tables and returns a boolean.

我怎样才能用这种方法比较两个数据表?两者都有相同的架构。

How can I compare 2 datatables in this way? Both have identical schemas.

推荐答案

您需要遍历每个表中的行,然后再通过每一列循环中来比较各个值。

You would need to loop through the rows of each table, and then through each column within that loop to compare individual values.

有一个code样品在这里:的http://canlu.blogspot.com/2009/05/how-to-compare-two-datatables-in-adonet.html

There's a code sample here: http://canlu.blogspot.com/2009/05/how-to-compare-two-datatables-in-adonet.html

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

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