比较表的行 [英] Comparing Rows of Table's

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

问题描述

你好朋友,



i希望将一个表的一行与另一个表的多行进行比较,如果该行存在于其他表的行中那么它应该给出一条已经存在记录的消息。



i希望在vb中实现这一点而我不知道如何完成这个任何人有任何示例代码如何做这在vb。



请需要帮助

hello friends,

i want to compare a single row of one table with multiple rows of other table and if that single row is present in other table's rows then it should give a message that record already existed.

i want to achieve this in vb and i dont have any idea how to accomplish this anyone has any sample code of how to do this in vb.

please needed help

推荐答案

试试这个:

Try this:
For Each dr As DataRow In FirstDataTable.Rows

	Dim results As System.Data.EnumerableRowCollection(Of System.Data.DataRow) = From myRow In SecondDataTable.AsEnumerable() Where (myRow.Field(Of String)("Id").Trim() = dr("Id").ToString().Trim())myRow

	If results.ToList().Count <> 0 Then


		MessageBox.Show("Row Exist")

	End If
Next


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

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