1、参考
Dim dt As DataTable = DataTables("三级分销主表")
For Each dr As DataRow In dt.Select("")
Dim s1 As String = ""
Dim s2 As String = ""
Dim s3 As String = ""
For Each cdr As DataRow In dt.Select("上级_编号 = '" & dr("编号") & "'")
s1 &= cdr("姓名") & ","
For Each ccdr As DataRow In dt.Select("上级_编号 = '" & cdr("编号") & "'")
s2 &= ccdr("姓名") & ","
For Each cccdr As DataRow In dt.Select("上级_编号 = '" & ccdr("编号") & "'")
s3 &= cccdr("姓名") & ","
Next
Next
Next
dr("一级推荐人员汇总") = s1.trim(",")
dr("二级推荐人员汇总") = s2.trim(",")
dr("三级推荐人员汇总") = s3.trim(",")
Next
2、参考
Dim dt As DataTable = DataTables("三级分销主表")
For Each dr As DataRow In dt.Select("")
Dim s1 As String = ""
Dim s2 As String = ""
Dim s3 As String = ""
Dim d1 As Double = 0
Dim d2 As Double = 0
Dim d3 As Double = 0
For Each cdr As DataRow In dt.Select("上级_编号 = '" & dr("编号") & "'")
s1 &= cdr("姓名") & ","
d1 += cdr("一级佣金")
For Each ccdr As DataRow In dt.Select("上级_编号 = '" & cdr("编号") & "'")
s2 &= ccdr("姓名") & ","
d2 += ccdr("二级佣金")
For Each cccdr As DataRow In dt.Select("上级_编号 = '" & ccdr("编号") & "'")
s3 &= cccdr("姓名") & ","
d3 += cccdr("三级佣金")
Next
Next
Next
dr("一级推荐人员汇总") = s1.trim(",")
dr("二级推荐人员汇总") = s2.trim(",")
dr("三级推荐人员汇总") = s3.trim(",")
dr("一级佣金汇总") = d1
dr("二级佣金汇总") = d2
dr("三级佣金汇总") = d3
Next
[此贴子已经被作者于2019/3/26 14:49:41编辑过]