Dim dr As Row = Tables("客观题答案").Rows(0) Dim lst1 As new List(of String) Dim lst2 As new List(of String) For Each r As Row In Tables("卷1答").Rows For Each c As Col In Tables("卷1答").Cols If r.IsNull(c.Name) Then Continue For If c.Name.StartsWith("客观题") Then lst1.Clear lst2.Clear Dim v As String = r(c.Name) For i As Integer = 0 To v.Length-1 lst1.Add(v(i)) Next v = dr(c.Name) For j As Integer = 0 To v.Length-1 If lst1.Contains(v(j)) Then lst1.Remove(v(j)) Else lst2.Add(v(j)) End If Next lst1.AddRange(lst2.ToArray()) For Each s As String In lst1 Dim filter = "统计号 = '" & c.Name.Replace("客观题","") & s.ToUpper() & "'" Dim drt As DataRow = DataTables("卷1统").Find(filter) If drt("错误学生").Contains(r("姓名")) = False Then drt("错误人数") = drt("错误人数")+1 drt("错误学生") = (drt("错误学生") & "," & r("姓名")).trimstart(",") End If Next ElseIf c.Name.StartsWith("主观题") Then If r(c.Name) = "F" Then Dim filter = "统计号 = '" & c.Name.Replace("观题","") & "'" Dim drt As DataRow = DataTables("卷1统").Find(filter) If drt("错误学生").Contains(r("姓名")) = False Then drt("错误人数") = drt("错误人数")+1 drt("错误学生") = (drt("错误学生") & "," & r("姓名")).trimstart(",") end if End If End If Next Next
|