使用两个名为dnddatatable和dtdup的数据表。它包含一组电话号码。我想比较第二个数据表和第一个数据表,并从datatable1(名称为dnddatatable)中删除值,这些值等于第二个数据表名称为(dtdup)。
data in the datatable as follows.
dnddatatable(data table1)
phone
9865015695
9840903331
98668625
800971868
809679532
837445478
dtdup(dtata table2)
phone_numbers
9865015695
9840903331
result dnddatatable(data table1)
98668625
800971868
809679532
837445478
答案 0 :(得分:1)
我很久以前回答了一个非常相似的问题,这个想法完全一样
For i As Integer = 0 To dataset.Tables(0).Rows.Count - 1
Dim found As Boolean = False
For j As Integer = 0 To dataset1.Tables(0).Rows.Count - 1
If dataset.Tables(0).Rows(i)(0).ToString = dataset1.Tables(0).Rows(j) (0).ToString Then
found = True
End If
Next
If found = False Then
'here you are getting the right result in each loop
'in this example i'm showing the result in a textbox
'just change the instruction and write them in your note pad or wherever you want to
MsgBox(dataset.Tables(0).Rows(i)(0).ToString)
End If
Next