Select Case e.DataCol.name Case "合同号","产品名" Dim pr As DataRow = e.DataRow.GetParentRow("产品名") If pr IsNot Nothing Then Dim prChild As DataRow = pr.GetChildRows("装货计划") If prChild IsNot Nothing Then e.DataRow("批次号") = prChild.Count +1 End If End If End Select