我使用的外部数据表每次打开软件时,库存都是空的,怎么回事,我代码有问题吗,
我使用内部数据表做了一遍,库存是正常的。
请老师帮忙改一下,谢谢!!!
Select Case e.DataCol.name
Case "日期","车号","入库柴油数量","加油"
Dim dr1 As DataRow = e.DataRow
Dim dr2 As DataRow
For Each dr As DataRow In e.DataTable.Select("[_SortKey] >= " & e.DataRow("_SortKey"))
Dim Val1 As Double = e.DataTable.Compute("Sum(入库柴油数量)","[_SortKey] <= " & dr("_SortKey"))
Dim Val2 As Double = e.DataTable.Compute("Sum(加油)","[_SortKey] <= " & dr("_SortKey"))
dr("库存柴油") = Val1 - Val2
Next
If dr1.IsNull("日期") OrElse dr1.IsNull("车号") Then
dr1("上次里程表数") = Nothing
Else
dr2 = e.DataTable.Find("车号 = '" & dr1("车号") & "' And 日期 < #" & dr1("日期") & "#","日期 Desc")
If dr2 IsNot Nothing Then
dr1("上次里程表数") = dr2("本次里程表数")
End If
End If
End Select