--
此主题相关图片如下:qq图片20211223004422.png

此主题相关图片如下:qq图片20211223004447.png

没有红色代码不报错,有它假如第2轮有人离赛,理应有一桌对手为空,另0桌单独显示没参赛人编号、姓名、上轮积分、累计积分,但由于多了红色代码,独立的这两行都没显,不要红色代码,这两行正常显示,但红色代码是判断第2轮先、后手的,要求保存,这种情况下应如何处理?ElseIf di2 = 2 And cnt = 0 Then
Dim drs2 As List(of DataRow) = DataTables("比赛积分").SQLSelect("[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & Cstr(Val(di2)-1) & "\' And [分组] = \'" & Str & "\'","","积分 Desc")
For ia As Integer = 0 To drs2.Count - 1
dr = DataTables("比赛积分").AddNew
Dim dts1 As DataRow = DataTables("基本信息").SQLFind("[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\' And [分组] = \'" & Str & "\' And [身份] = \'参赛人\' And [缺赛轮号] like \'%" & di2 & "%\' and [编号] = \'" & drs2(ia)("编号") & "\'")
If dts1 IsNot Nothing Then
dr("排序") = 0
Else
dr("排序") = math.Ceiling(ii2 / 2)
ii2 + = 1
End If
dr("棋赛名称") = di1
dr("棋赛副名") = Forms("主窗口").Controls("TextBox4").text
dr("第几轮比赛") = di2
dr("日期") = di3
dr("上轮名次") = drs2(ia)("名次")
dr("编号") = drs2(ia)("编号")
dr("姓名") = drs2(ia)("姓名")
dr("团体赛或个人赛") = lx
dr("分组") = Str
dr("上轮止累计积分") = drs2(ia)("积分")
dr("曾交战对手累计积分") = DataTables("比赛积分").SQLCompute("SUM(积分)","[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\' And [分组] = \'" & Str & "\' And [排序] = " & drs2(ia)("排序") & " And ([编号] <> \'" & drs2(ia)("编号") & "\'or [姓名] <> \'" & drs2(ia)("姓名") & "\')")
Next
DataTables("比赛积分").Load
DataTables("比赛积分").Save()
tbl.Table.DataTable.DataRows.Clear
Dim drs3a As List(of DataRow) = DataTables("比赛积分").SQLSelect("[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\'And [第几轮比赛] = \'" & di2 & "\' And [分组] = \'" & Str & "\' And [排序] <> 0","","上轮名次")
Dim zh As Integer = 1
For ib As Integer = 0 To drs3a.count - 1 Step 2
Dim nr As DataRow = tbl.Table.DataTable.AddNew()
nr("桌号") = zh
zh + = 1
Dim dr2a As DataRow = DataTables("比赛积分").SQLFind("[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & Cstr(Val(di2)-1) & "\' And [分组] = \'" & Str & "\' And [编号] = \'" & drs3a(ib)("编号") & "\'")
Dim dr2b As DataRow = DataTables("比赛积分").SQLFind("[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & Cstr(Val(di2)-1) & "\' And [分组] = \'" & Str & "\' And [编号] = \'" & drs3a(ib+1)("编号") & "\'")
If dr2a IsNot Nothing AndAlso dr2b IsNot Nothing And dr2a("红黑方") = "红方" And dr2b("红黑方") = "黑方" Then
nr("红方_名次") = drs3a(ib+1)("上轮名次")
nr("红方_编号") = drs3a(ib+1)("编号")
nr("红方_姓名") = drs3a(ib+1)("姓名")
nr("红方_上轮止累计积分") = drs3a(ib+1)("上轮止累计积分")
nr("红方_曾交战对手累计积分") = drs3a(ib+1)("曾交战对手累计积分")
nr("黑方_名次") = drs3a(ib)("上轮名次")
nr("黑方_编号") = drs3a(ib)("编号")
nr("黑方_姓名") = drs3a(ib)("姓名")
nr("黑方_上轮止累计积分") = drs3a(ib)("上轮止累计积分")
nr("黑方_曾交战对手累计积分") = drs3a(ib)("曾交战对手累计积分")
ElseIf dr2a IsNot Nothing AndAlso dr2b IsNot Nothing And dr2a("红黑方") = "黑方" And dr2b("红黑方") = "红方" Then
nr("红方_名次") = drs3a(ib)("上轮名次")
nr("红方_编号") = drs3a(ib)("编号")
nr("红方_姓名") = drs3a(ib)("姓名")
nr("红方_上轮止累计积分") = drs3a(ib)("上轮止累计积分")
nr("红方_曾交战对手累计积分") = drs3a(ib)("曾交战对手累计积分")
nr("黑方_名次") = drs3a(ib+1)("上轮名次")
nr("黑方_编号") = drs3a(ib+1)("编号")
nr("黑方_姓名") = drs3a(ib+1)("姓名")
nr("黑方_上轮止累计积分") = drs3a(ib+1)("上轮止累计积分")
nr("黑方_曾交战对手累计积分") = drs3a(ib+1)("曾交战对手累计积分")
Else
Dim c As Integer = rand.Next(0,2)
Dim c1 As Integer = IIF(c = 0,1,0)
c = ib + c
c1 = ib + c1
If c <= drs3a.Count - 1
nr("红方_名次") = drs3a(c)("上轮名次")
nr("红方_编号") = drs3a(c)("编号")
nr("红方_姓名") = drs3a(c)("姓名")
nr("红方_上轮止累计积分") = drs3a(c)("上轮止累计积分")
nr("红方_曾交战对手累计积分") = drs3a(c)("曾交战对手累计积分")
End If
If c1 <= drs3a.Count - 1
nr("黑方_名次") = drs3a(c1)("上轮名次")
nr("黑方_编号") = drs3a(c1)("编号")
nr("黑方_姓名") = drs3a(c1)("姓名")
nr("黑方_上轮止累计积分") = drs3a(c1)("上轮止累计积分")
nr("黑方_曾交战对手累计积分") = drs3a(c1)("曾交战对手累计积分")
End If
End If
Next
DataTables("比赛积分").SQLUpdate(drs3a)