Select Case e.DataCol.Name '判断修改的列名
Case "商品编号" '如果值是商品编号,则执行下面的语句
Dim pr As DataRow = DataTables("商品规格表").find("商品编号 = '" & e.NewValue & "'") '设置一个标量pr,其行号等于商品规格表内的商品编号等于新输入值得行
Dim prs As List(of DataRow) = DataTables("订单表").Select("客户编号 = '" & e.DataRow("客户编号") "'" And ("商品编号 = '" & e.NewValue & "'") ,"日期 desc")
If prs IsNot Nothing Then
prs(0)("单位") = e.DataRow("单位")
prs(0)("单价") = e.DataRow("单价")
Else
If pr IsNot Nothing Then '如果找到了
e.DataRow("数量") = 1
e.DataRow("单位") = pr("单位")
e.DataRow("单价") = pr("售价")
Else
e.DataRow("单位") = Nothing
e.DataRow("数量") = Nothing
e.DataRow("单价") = Nothing
e.DataRow("折扣") = Nothing
End If
End If
End Select