下面的代码只能查找已加载数据?没加载的无反应,我想能查找所有后台所有数据,代码错在哪?
If Forms("主窗口").opened Then
Dim qsmc As WinForm.ComboBox = Forms("主窗口").Controls("棋赛名称")
Dim di1 As String = qsmc.Value
If di1 = "" Then
messagebox.show("请选择棋赛名称")
Return
End If
Dim m As WinForm.TextBox = Forms("主窗口").Controls("第几轮")
Dim di2 As String = m.Value
If di2 = "" Then
messagebox.show("请输入第几轮")
Return
End If
Dim bsrq As WinForm.DateTimePicker = Forms("主窗口").Controls("rq")
Dim di3 As Date = bsrq.Value
If Forms("主窗口").Controls("rq").text = "" Then
messagebox.show("请选择日期")
Return
End If
Dim bslx As WinForm.TextBox = Forms("主窗口").Controls("bslx")
Dim lx As String = bslx.Value
Dim fz As WinForm.DropDownBox = Forms("主窗口").Controls("fenzhu")
Dim Str As String = fz.Value
If Forms("主窗口").Controls("fenzhu").text = "" Then
messagebox.show("请选择分组")
Return
End If
Dim tbl As WinForm.Table
Dim tab As WinForm.TabControl = Forms("主窗口").Controls("TabControl1")
If tab.TabPages.Contains(Str) = False Then
tab.TabPages.Add(Str,Str)
tbl = Forms("主窗口").CreateSQLTable("Table'" & Str & "'","Select * Fr om {综合组}","")
tbl.SetBounds(0, 0, 983, 580)
Forms("主窗口").Controls("TabControl1").Tabpages(Str).AddControl(tbl)
Forms("主窗口").Controls("TabControl1").SelectedIndex = tab.TabPages.count + 1
Else
tbl = Forms("主窗口").Controls("Table'" & Str & "'")
End If
tbl.Table.SetColVisibleWidth("桌号|30|红方_名次|40|红方_编号|40|红方_姓名|60|红方_上轮止累计积分|80|红方_曾交战对手累计积分|80|红方_签名|60|当前局成绩_红方|80|当前局成绩_黑方|80|黑方_签名|60|黑方_名次|40|黑方_编号|40|黑方_姓名|60|黑方_上轮止累计积分|80|黑方_曾交战对手累计积分|80")
tbl.Table.SetHeaderRowHeight(40)
tbl.Table.DataTable.DataRows.Clear
Dim drs As List(of DataRow) = DataTables("比赛积分").SQLSelect("[团体赛或个人赛] = '" & lx & "' And [棋赛名称] = '" & di1 & "' And [第几轮比赛] = '" & di2 & "' And [分组] = '" & Str & "'","","日期 Desc,团体赛或个人赛,棋赛名称,分组,桌号 Desc")
For Each s As Integer In DataTables("比赛积分").SQLGetValues("桌号","[团体赛或个人赛] = '" & lx & "' And [棋赛名称] = '" & di1 & "'And [第几轮比赛] = '" & di2 & "' And [分组] = '" & Str & "' And [桌号] > 0","桌号")
Dim nr As DataRow = tbl.Table.DataTable.AddNew
nr("桌号") = s
Dim dr As DataRow = DataTables("比赛积分").SQLFind("[团体赛或个人赛] = '" & lx & "' And [棋赛名称] = '" & di1 & "'And [第几轮比赛] = '" & di2 & "' And [分组] = '" & Str & "' And [桌号] = " & s & " And [红黑方] = '红方'")
If dr IsNot Nothing Then
nr("红方_名次") = dr("上轮名次")
nr("红方_编号") = dr("编号")
nr("红方_姓名") = dr("姓名")
nr("红方_上轮止累计积分") = dr("上轮止累计积分")
nr("红方_曾交战对手累计积分") = dr("曾交战对手累计积分")
nr("当前局成绩_红方") = dr("积分")
End If
dr = DataTables("比赛积分").SQLFind("[团体赛或个人赛] = '" & lx & "' And [棋赛名称] = '" & di1 & "'And [第几轮比赛] = '" & di2 & "' And [分组] = '" & Str & "' And [桌号] = " & s & " And [红黑方] = '黑方'")
If dr IsNot Nothing Then
nr("黑方_名次") = dr("上轮名次")
nr("黑方_编号") = dr("编号")
nr("黑方_姓名") = dr("姓名")
nr("黑方_上轮止累计积分") = dr("上轮止累计积分")
nr("黑方_曾交战对手累计积分") = dr("曾交战对手累计积分")
nr("当前局成绩_黑方") = dr("积分")
End If
Next
Dim drs6 As List(of DataRow) = DataTables("比赛积分").SQLSelect("[团体赛或个人赛] = '" & lx & "' And [棋赛名称] = '" & di1 & "'And [第几轮比赛] = '" & di2 & "' And [分组] = '" & Str & "' And [桌号] = 0","","桌号")
Dim drs7 As List(of DataRow) = DataTables("比赛积分").SQLSelect("[团体赛或个人赛] = '" & lx & "' And [棋赛名称] = '" & di1 & "'And [第几轮比赛] = '" & di2 & "' And [分组] = '" & Str & "' And [桌号] = 0 And [红黑方] = '红方'","","桌号")
Dim drs8 As List(of DataRow) = DataTables("比赛积分").SQLSelect("[团体赛或个人赛] = '" & lx & "' And [棋赛名称] = '" & di1 & "'And [第几轮比赛] = '" & di2 & "' And [分组] = '" & Str & "' And [桌号] = 0 And [红黑方] = '黑方'","","桌号")
For ci As Integer = 0 To math.Ceiling((drs6.Count - 1) / 2)
Dim nr As DataRow = tbl.Table.DataTable.AddNew
If drs7.count < drs8.count Then
If ci <= drs7.count - 1 And ci < drs8.count - 1 Then
nr("桌号") = 0
nr("红方_名次") = drs7(ci)("上轮名次")
nr("红方_编号") = drs7(ci)("编号")
nr("红方_姓名") = drs7(ci)("姓名")
nr("红方_上轮止累计积分") = drs7(ci)("上轮止累计积分")
nr("红方_曾交战对手累计积分") = drs7(ci)("曾交战对手累计积分")
nr("当前局成绩_红方") = IIF(drs7(ci).IsNull("积分"),"0",drs7(ci)("积分"))
nr("黑方_名次") = drs8(ci)("上轮名次")
nr("黑方_编号") = drs8(ci)("编号")
nr("黑方_姓名") = drs8(ci)("姓名")
nr("黑方_上轮止累计积分") = drs8(ci)("上轮止累计积分")
nr("黑方_曾交战对手累计积分") = drs8(ci)("曾交战对手累计积分")
nr("当前局成绩_黑方") = IIF(drs8(ci).IsNull("积分"),"0",drs8(ci)("积分"))
ElseIf ci > drs7.count - 1 And ci <= drs8.count - 1 Then
nr("桌号") = 0
nr("红方_编号") = Nothing
nr("红方_姓名") = Nothing
nr("红方_上轮止累计积分") = 0
nr("红方_曾交战对手累计积分") = 0
nr("当前局成绩_红方") = 0
nr("黑方_名次") = drs8(ci)("上轮名次")
nr("黑方_编号") = drs8(ci)("编号")
nr("黑方_姓名") = drs8(ci)("姓名")
nr("黑方_上轮止累计积分") = drs8(ci)("上轮止累计积分")
nr("黑方_曾交战对手累计积分") = drs8(ci)("曾交战对手累计积分")
nr("当前局成绩_黑方") = IIF(drs8(ci).IsNull("积分"),"0",drs8(ci)("积分"))
End If
ElseIf drs7.count > drs8.count Then
If ci < drs7.count - 1 And ci <= drs8.count - 1 Then
nr("桌号") = 0
nr("红方_名次") = drs7(ci)("上轮名次")
nr("红方_编号") = drs7(ci)("编号")
nr("红方_姓名") = drs7(ci)("姓名")
nr("红方_上轮止累计积分") = drs7(ci)("上轮止累计积分")
nr("红方_曾交战对手累计积分") = drs7(ci)("曾交战对手累计积分")
nr("当前局成绩_红方") = IIF(drs7(ci).IsNull("积分"),"0",drs7(ci)("积分"))
nr("黑方_名次") = drs8(ci)("上轮名次")
nr("黑方_编号") = drs8(ci)("编号")
nr("黑方_姓名") = drs8(ci)("姓名")
nr("黑方_上轮止累计积分") = drs8(ci)("上轮止累计积分")
nr("黑方_曾交战对手累计积分") = drs8(ci)("曾交战对手累计积分")
nr("当前局成绩_黑方") = IIF(drs8(ci).IsNull("积分"),"0",drs8(ci)("积分"))
ElseIf ci <= drs7.count - 1 And ci > drs8.count - 1 Then
nr("桌号") = 0
nr("红方_名次") = drs7(ci)("上轮名次")
nr("红方_编号") = drs7(ci)("编号")
nr("红方_姓名") = drs7(ci)("姓名")
nr("红方_上轮止累计积分") = drs7(ci)("上轮止累计积分")
nr("红方_曾交战对手累计积分") = drs7(ci)("曾交战对手累计积分")
nr("当前局成绩_红方") = IIF(drs7(ci).IsNull("积分"),"0",drs7(ci)("积分"))
nr("黑方_名次") = Nothing
nr("黑方_编号") = Nothing
nr("黑方_姓名") = Nothing
nr("黑方_上轮止累计积分") = 0
nr("黑方_曾交战对手累计积分") = 0
nr("当前局成绩_黑方") = 0
End If
End If
Next
End If
[此贴子已经被作者于2021/12/27 14:13:55编辑过]