For Each dr As DataRow In DataTables("库存表").DataRows
Dim val As Decimal = dt.Compute("Max(_SortKey)","产品 = '" & dr("产品") & "'")
Dim dr1 As DataRow = dt.Find("产品 = '" & dr("产品
") & "' And _SortKey = " & val,"日期 Desc")
If dr1 IsNot Nothing Then
dr("库存") = dr1("库存")
End If
Next
1、上面的产品 dr("产品
") 不要流空格
2、

此主题相关图片如下:未命名.jpg