以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 向下移一行 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=174067) |
-- 作者:采菊东篱下 -- 发布时间:2021/12/30 10:35:00 -- 向下移一行 我想把整行向下移一行,这样只是drs3a(ia1+1)("编号")单元格的数据移一行吧?请教怎样实现整行移动? Dim drs3a As List(of DataRow) = DataTables("比赛积分").SQLSelect("[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\'And [第几轮比赛] = \'" & di2 & "\' And [分组] = \'" & Str & "\' And [排序] <> 0") For ia1 As Integer = 0 To drs3a.Count - 1 Step 2 If ia1+1 < drs3a.count Then For ia As Integer = 0 To drs2.Count - 1 Dim dr2a1 As DataRow = DataTables("比赛积分").SQLFind("[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & Cstr(Val(di2)-1) & "\' And [分组] = \'" & Str & "\' And [排序] = " & drs2(ia)("排序") & " And ([编号] <> \'" & drs2(ia)("编号") & "\'or [姓名] <> \'" & drs2(ia)("姓名") & "\')") If drs3a(ia1+1)("编号") = dr2a1("编号") Then With drs3a(ia1+1)("编号") .drs3a(ia1+1)("编号").Move(.Position + 1) End With End If Next End If Next |
-- 作者:有点蓝 -- 发布时间:2021/12/30 10:47:00 -- 加载进来的数据,也就是table才有移动行功能,后台数据库不存在移动行的概念。 |
-- 作者:采菊东篱下 -- 发布时间:2021/12/30 11:01:00 -- 它是一个分页加载的表,如何实现自动生成的数据,移动一下行的位置? Dim dr As DataRow = DataTables("比赛积分").SQLfind("[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & di2 & "\' And [分组] = \'" & Str & "\'") Dim dts As List(of DataRow) = DataTables("基本信息").SQLSelect("[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\' And [分组] = \'" & Str & "\' And [身份] = \'参赛人\'") DataTables("比赛积分").DeleteFor("[棋赛名称] Is null") Dim cnt As Integer = DataTables("比赛积分").Compute("Count([姓名])", "[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & di2 & "\' And [分组] = \'" & Str & "\'") If di2 = 1 And cnt = 0 Then Do While dts.Count > 0 Dim idx As Integer = rand.Next(0,dts.Count) dr = DataTables("比赛积分").AddNew() dr("排序") = math.Ceiling(i2 / 2) dr("日期") = di3 dr("棋赛名称") = di1 dr("棋赛副名") = Forms("主窗口").Controls("TextBox4").text dr("第几轮比赛") = di2 dr("编号") = dts(idx)("编号") dr("姓名") = dts(idx)("姓名") dr("团体赛或个人赛") = lx dr("分组") = Str dts.RemoveAt(idx) i2 = i2 + 1 Loop DataTables("比赛积分").Load DataTables("比赛积分").Save() tbl.Table.DataTable.DataRows.Clear Dim drs1 As List(of DataRow) = DataTables("比赛积分").SQLSelect("[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & di2 & "\' And [分组] = \'" & Str & "\'","","排序") For i As Integer = 0 To drs1.Count - 1 Dim nr As DataRow If i <= drs1.Count And i Mod 2 = 0 Then nr = tbl.Table.DataTable.AddNew() nr("桌号") = drs1(i)("排序") nr("红方_编号") = drs1(i)("编号") nr("红方_姓名") = drs1(i)("姓名") ElseIf i <= drs1.Count And i Mod 2 = 1 Then nr("黑方_编号") = drs1(i)("编号") nr("黑方_姓名") = drs1(i)("姓名") End If Next DataTables("比赛积分").SQLUpdate(drs1) 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() Dim drs3a As List(of DataRow) = DataTables("比赛积分").SQLSelect("[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\'And [第几轮比赛] = \'" & di2 & "\' And [分组] = \'" & Str & "\' And [排序] <> 0") For ia1 As Integer = 0 To drs3a.Count - 1 Step 2 If ia1+1 < drs3a.count Then For ia As Integer = 0 To drs2.Count - 1 Dim dr2a1 As DataRow = DataTables("比赛积分").SQLFind("[团体赛或个人赛] = \'" & lx & "\' And [棋赛名称] = \'" & di1 & "\' And [第几轮比赛] = \'" & Cstr(Val(di2)-1) & "\' And [分组] = \'" & Str & "\' And [排序] = " & drs2(ia)("排序") & " And ([编号] <> \'" & drs2(ia)("编号") & "\'or [姓名] <> \'" & drs2(ia)("姓名") & "\')") If drs3a(ia1+1)("编号") = dr2a1("编号") Then With drs3a(ia1+1)("编号") .Move(.Position + 1) End With End If Next End If Next
[此贴子已经被作者于2021/12/30 15:03:59编辑过]
|
-- 作者:采菊东篱下 -- 发布时间:2021/12/30 11:03:00 -- 意思是第2轮的排座,如果上一轮已经交过手,自动调整为跟下一行对手交战。 |
-- 作者:有点蓝 -- 发布时间:2021/12/30 11:21:00 -- 数据库是不存在上一行下一行的概念的。可以对Tables("比赛积分")进行筛选,然后移动行 |
-- 作者:采菊东篱下 -- 发布时间:2021/12/30 11:34:00 -- 我知道只能在Tables下移动行,问题是这是一个分页加载的表,一个大型比赛动辙几十、上百个人,不可能在同一页显示,这种情况下应如何处理? |
-- 作者:采菊东篱下 -- 发布时间:2021/12/30 11:35:00 -- 通过临时表过渡? |
-- 作者:有点蓝 -- 发布时间:2021/12/30 11:52:00 -- 考虑改排序列_sortkey的值,比如a行排序列为1,b行排序列为2,这2行互换位置就是把a_sortkey改为2,b_sortkey改为1 |
-- 作者:采菊东篱下 -- 发布时间:2021/12/30 14:05:00 -- 不行对阵表不是根据排序取数的,而是根据第1次比赛排序后安顺序位置取数,改变排位数值不改变位置,对取数没影响,所以还是要考虑移动上、下行位置,不然对阵表代码要改。 [此贴子已经被作者于2021/12/30 14:06:17编辑过]
|
-- 作者:有点蓝 -- 发布时间:2021/12/30 14:07:00 -- 那我也不懂了,业务的东西自己解决了 |