运行下面代码出错
Select Case e.DataCol.Name
Case "产品名称","产品颜色","产品规格","销售价"
Dim Filter As String = "产品型号 =" & e.DataRow("产品型号")
Dim drs As List(of DataRow) = DataTables("订单明细表").Select(Filter)
For Each dr As DataRow In drs
dr("产品名称") = e.DataRow("产品名称")
If dr.Locked = False AndAlso dr("已发货") = False
dr("销售价") = e.DataRow("销售价")
End If
Next
Case "产品型号"
Dim Filter As String = "产品型号 =" & e.DataRow("产品型号")
e.DataRow("销售_数量") = DataTables("订单明细表").Compute("Sum(数量)", Filter)
e.DataRow("销售_金额") = DataTables("订单明细表").Compute("Sum(金额)", Filter)
e.DataRow("未发货订单_数量") = DataTables("订单明细表").Compute("Sum(数量)", Filter & " And 已付款 = true")
e.DataRow("未发货订单_金额") = DataTables("订单明细表").Compute("Sum(金额)", Filter & " And 已付款 = true")
If e.DataCol.Name = "产品型号"
Dim pr As DataRow
If e.NewValue Is Nothing Then
e.DataRow("销售价") = Nothing
e.DataRow("产品名称") = Nothing
Else
pr = DataTables("产品信息表").Find("[产品型号] = " & e.NewValue)
If pr IsNot Nothing Then
e.DataRow("销售价") = pr("销售价")
e.DataRow("产品名称") = pr("产品名称")
If e.OldValue <> e.NewValue Then '如果新旧产品编号不同.
DataTables("产品信息表").DataCols("产品型号").RaiseDataColChanged(pr)
End If
End If
End If
If e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
pr = DataTables("产品信息表").Find("[产品型号] = " & e.OldValue)
If pr IsNot Nothing Then
DataTables("产品信息表").DataCols("产品型号").RaiseDataColChanged(pr)
End If
End If
End If
Select Case e.DataCol.Name
Case "数量","折扣","已付款","销售价"
If e.OldValue <> e.NewValue Then
Dim pr As DataRow
pr = DataTables("产品信息表").Find("[产品型号] = " & e.DataRow("产品型号") )
If pr IsNot Nothing Then
DataTables("产品信息表").DataCols("产品型号").RaiseDataColChanged(pr)
End If
End If
End Select
此主题相关图片如下:4-22.jpg