Dim dr As DataRow = e.DataRow
Dim pr As DataRow = dr.GetParentRow("销售订单")
If pr IsNot Nothing Then
Select Case e.DataCol.Name
Case "柜型","柜号"
Dim T1,Ts As String
Dim Ls As List(Of String)
Dim dts As DataTable = DataTables("柜型柜号")
Ls = dts.GetUniqueValues("[销售合同号] = '" & pr("销售合同号") & "'","柜型") '从指定列中,获取不重复的值,以集合的形式返回.
For Each T1 In Ls '根据指定的表达式和条件进行计算
Ts = Ts & " " & dts.Compute("Count(柜型)","[销售合同号] = '" & pr("销售合同号") & "'and [柜型] = '" & T1.Replace("'","''") & "'") & "×" & T1
Next
pr("柜量") = Ts.substring(1) '返回从指定位置开始指定长度的子字符串
dr("柜型柜号") = dr("柜号") & "/" & dr("柜型")
End Select
End If
遇到代码问题,可以看看:
http://www.foxtable.com/help/topics/1485.htm