以下代码是将产品明细表明细分段列最后1行上传到产品总帐表的库存分段列.产品总帐表与产品明细表为关联表.问题:如果插入了一行,则上传失败.
If e.DataCol.Name = "明细分段" Then
Dim dr As DataRow =e.DataRow.GetParentRow("产品总帐")
If dr IsNot Nothing Then
Dim drs As List(Of DataRow) = dr.GetChildRows("产品明细")
For i As Integer = drs.Count -1 To 0 Step -1
If drs(i).IsNull("明细分段") = False Then
dr("库存分段") = drs(i)("明细分段")
Exit For
End If
Next
End If
End If