以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 不是用了SQL吗?怎么只能查找当前数据? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=174013) |
-- 作者:采菊东篱下 -- 发布时间:2021/12/27 11:50:00 -- 不是用了SQL吗?怎么只能查找当前数据? 下面的代码只能查找已加载数据?没加载的无反应,我想能查找所有后台所有数据,代码错在哪? 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编辑过]
|
-- 作者:有点蓝 -- 发布时间:2021/12/27 11:56:00 -- 指SQLSelect?肯定是查后台的,除非数据没有保存 |
-- 作者:采菊东篱下 -- 发布时间:2021/12/27 12:15:00 -- 生成数据后已经写上这代码,应该保存了。 DataTables("比赛积分").SQLUpdate(drs5a)
|
-- 作者:采菊东篱下 -- 发布时间:2021/12/27 12:31:00 -- 保存数据按钮也有 DataTables("比赛积分").SQLUpdate(drs)
|
-- 作者:有点蓝 -- 发布时间:2021/12/27 13:31:00 -- 1、数据没有保存 2、条件有问题,没有符合条件的数据
|
-- 作者:采菊东篱下 -- 发布时间:2021/12/27 14:10:00 -- 肯定有符合条件的数据,按保存按钮比赛积分表才看到数据的,最后是DataTables("比赛积分").SQLUpdate(drs5a)代码。 [此贴子已经被作者于2021/12/27 14:12:24编辑过]
|
-- 作者:采菊东篱下 -- 发布时间:2021/12/27 14:12:00 -- 分页加载页面有这数据就正常显示,点下一页就查不到数据了。 |
-- 作者:有点蓝 -- 发布时间:2021/12/27 14:46:00 -- 请上传实例测试 |
-- 作者:采菊东篱下 -- 发布时间:2021/12/27 19:31:00 -- 要上传就变成整个项目上传,想重做个简单例子,涉及到窗口,菜单按钮,太麻烦了,不传了。 |