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