Select Case e.DataCol.Name
Case "合同编号","批次号"
If dr.isnull("合同编号") =false Then
Dim pr As DataRow
pr = DataTables("合同").Find("[合同编号] = '" & e.datarow("合同编号“) & "'")
If pr IsNot Nothing Then '如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("单价") = pr("结算单价")
End If
ElseIf dr.isnull("批次号") =false Then
Dim mr As DataRow
mr = DataTables("合同").Find("[批次号] = '" & e.datarow("批次号“) & "'")