以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 共享:连续填充问题(Czy老师) (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=5440) |
||||
-- 作者:abcdzabcdz -- 发布时间:2009/12/11 12:28:00 -- 共享:连续填充问题(Czy老师) 问题:连续填充
[此贴子已经被作者于2009-12-12 1:41:59编辑过]
|
||||
-- 作者:abcdzabcdz -- 发布时间:2009/12/11 12:29:00 -- 问题CZY老师早也解决,不敢独享,故为C版占位: DataTables("过渡表").DataRows.Clear() Tables("过渡表").Redraw = False Dim dt As Table = Tables("过渡表") Dim Count As Integer = Tables("课程表").Count Dim dr As DataRow Dim ColNames() As String = {"星期一","星期二","星期三","星期四","星期五","星期六"} Dim Max As Integer = DataTables("参数表").Compute("Max(重复填充次数)") For i As integer = 0 to Max -1 \'不管三七二十一,所有数据全部重复向过渡表写入最大值次数 For Each dr1 As DataRow In DataTables("课程表").DataRows Dim dr2 As DataRow = DataTables("过渡表").AddNew() For Each dc As DataCol In DataTables("过渡表").DataCols dr2(dc.name) = dr1(dc.name) Next Next Next For Each ColName As string In ColNames \'折腾一下吧,删除多余的数据 dr = DataTables("参数表").Find("星期 = \'" & ColName & "\'") For c As integer = 0 to 9 For i As integer = dr("重复填充次数")*Count to dt.rows.count -1 dt.Rows(i)(ColName & "_" & c+1) = nothing Next Next Next Tables("过渡表").Redraw = True [此贴子已经被作者于2009-12-12 1:48:12编辑过]
|
||||
-- 作者:czy -- 发布时间:2009/12/11 16:20:00 -- 我来蛮干一下。 DataTables("过渡表").DataRows.Clear() Tables("过渡表").Redraw = False Dim dt As Table = Tables("过渡表") Dim Count As Integer = Tables("课程表").Count Dim dr As DataRow Dim ColNames() As String = {"星期一","星期二","星期三","星期四","星期五","星期六"} Dim Max As Integer = DataTables("参数表").Compute("Max(重复填充次数)") For i As integer = 0 to Max -1 \'不管三七二十一,所有数据全部重复向过渡表写入最大值次数 For Each dr1 As DataRow In DataTables("课程表").DataRows Dim dr2 As DataRow = DataTables("过渡表").AddNew() For Each dc As DataCol In DataTables("过渡表").DataCols dr2(dc.name) = dr1(dc.name) Next Next Next For Each ColName As string In ColNames \'折腾一下吧,删除多余的数据 dr = DataTables("参数表").Find("星期 = \'" & ColName & "\'") For c As integer = 0 to 9 For i As integer = dr("重复填充次数")*Count to dt.rows.count -1 dt.Rows(i)(ColName & "_" & c+1) = nothing Next Next Next Tables("过渡表").Redraw = True |