ここで行ったことは、2 つの列のテーブルを配列リストと辞書に保存することです。
Dim result As New ArrayList()
While dr.Read()
' Insert each column into a dictionary
Dim dict As New Dictionary(Of String, Object)
For count As Integer = 0 To (dr.FieldCount - 1)
dict.Add(dr.GetName(count), dr(count))
Next
' Add the dictionary to the ArrayList
result.Add(dict)
End While
.........今、私はそれを調べて、見つかったら削除したいと思います。大量のデータがあるため、時間を節約できます。「コレクションが変更されました。列挙操作が実行されない可能性があります」というエラーが表示されます。取り外して次へ。問題は理解できましたが、どうすればこれを克服できますか? 削除してループに変換する方法は?
For Each dat As Dictionary(Of String, Object) In result
comp2 = dat("ID")
If comp2 = comp Then
advcode = advcode & "," & dat("ADVC")
found = True
firstattempt = False
result.Remove(dat)
Else
If found And Not firstattempt Then Exit For
End If
Next