1

インメモリがDataTableあり、重複をマークする必要があります.....たとえば..

から ここに画像の説明を入力ここに画像の説明を入力

私はおそらく次のようなことをするでしょう..

    For each dtrow in dt.rows
    If dtrow("Country") Is one of Duplicates then
            dtrow("Country") += "*"
    end if
    Next

たくさんの質問をして申し訳ありません..私の頭は燃えています..何も出てきませんでした..そして、このプロジェクトはすぐに終了する必要があります..

4

1 に答える 1

5

使用できますLINQ-to-DataTable

Dim dups = From row In dt.AsEnumerable()
           Let country = row.Field(Of String)("Country")
           Group row By country Into DupCountries = Group
           Where DupCountries.Count() > 1
           Select DupCountries
For Each dupCountryRows In dups
    For Each row In dupCountryRows
        row("Country") = row.Field(Of String)("Country") & "*"
    Next
Next

または C# 構文で:

var dups = from row in dt.AsEnumerable()
           let id = row.Field<string>("Country")
           group row by country
           into DupCountries where DupCountries.Count() > 1
           select DupCountries;
于 2012-05-15T12:30:01.680 に答える