下面将为您提供一个新表,其中包含 RelatedTo 和 RulesID 的唯一组合。从那里您可以使用For...Next
循环来计算行数。
Dim matches As New DataTable("matches")
matches.Columns.Add("ID")
matches.Columns.Add("RelatesTo")
matches.Columns.Add("RulesID")
matches.Rows.Add("ID10", "ID1", "Rule1")
matches.Rows.Add("ID11", "ID1", "Rule1")
matches.Rows.Add("ID12", "ID1", "Rule2")
matches.Rows.Add("ID13", "ID1", "Rule3")
matches.Rows.Add("ID14", "ID2", "Rule1")
matches.Rows.Add("ID15", "ID2", "Rule3")
matches.Rows.Add("ID16", "ID3", "Rule2")
matches.Rows.Add("ID17", "ID3", "Rule3")
matches.Rows.Add("ID18", "ID4", "Rule3")
Dim unique As DataTable = matches.DefaultView.ToTable("unique", True, New String() {"RelatesTo", "RulesID"})