Foxtable(狐表)用户栏目专家坐堂 → 共享:连续填充问题(Czy老师)


  共有18032人关注过本帖树形打印复制链接

主题:共享:连续填充问题(Czy老师)

帅哥哟,离线,有人找我吗?
czy
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章 三级勋章 二级勋章
等级:超级版主 帖子:6318 积分:33963 威望:0 精华:10 注册:2008/8/31 20:56:00
  发帖心情 Post By: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

 回到顶部