我来蛮干一下。
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
|