2012-10-15 3 views
0

используя два типа данных, называемых dnddatatable и dtdup. он содержит набор телефонных номеров. Я хочу сравнить второй тип данных с первым datatable и удалить значения из значений datatable1 (name as dnddatatable), которые равны второму имени datatable как (dtdup).сравнить datatable и удалить дубликаты в vb.net

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 

ответ

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 
Смежные вопросы