Foxtable(狐表)用户栏目专家坐堂 → [求助]页码计算问题。


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

主题:[求助]页码计算问题。

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109736 积分:558396 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/5/15 8:46:00 [显示全部帖子]

Select Case e.DataCol.Name
    Case "页数"
        Dim dr As DataRow
        Dim drs As List(of DataRow)
        dr = e.DataTable.Find("台账编号 = '" & e.DataRow("台账编号") & "' and [_SortKey] < " & e.DataRow("_SortKey"), "[_SortKey] Desc") '找出上一行
        If dr Is Nothing Then '如果没有找到上一行,说明本行就是第一行
            e.DataRow("开始页") = 1
            dr = e.DataRow
        Else
            e.DataRow("开始页") = dr("结束页") + 1
        End If
        drs = e.DataTable.Select("台账编号 = '" & e.DataRow("台账编号") & "' and [_SortKey] >= " & dr("_SortKey"), "[_SortKey]")
        For i As Integer = 1 To drs.Count - 1 '
            drs(i)("开始页") = drs(i-1)("结束页") + 1
        Next
    Case "开始页"
        If e.DataRow.IsNull("开始页") Then
            e.DataRow("结束页") = Nothing
        Else
            e.DataRow("结束页") = e.DataRow("开始页") + e.DataRow("页数") - 1
        End If
End Select

 回到顶部