老师,下面代码有什么地方不对吗?
If e.DataCol.name = "年份" OrElse e.DataCol.name = "来源" OrElse e.DataCol.name = "商品名称" Then
If e.DataRow.Isnull("年份") = False AndAlso e.DataRow.Isnull("来源") =False AndAlso e.DataRow.Isnull("商品名称") = False Then
Dim filter1 As String = "来源 = '" & e.DataRow("来源") & "'"
Dim filter2 As String = "来源 = '" & e.DataRow("来源") & "'"
For i As Integer = 1 To 12
Dim d As Date = new Date(val(e.DataRow("年份")), i, 1)
Dim sum As Integer = DataTables("进销存").compute("sum(出库_金额)", filter1 & " and 日期 >= #" & d & "# and 日期 < #" & d.addmonths(1) & "#")
Dim sum1 As Integer = DataTables("进销存").compute("sum(入库_金额)", filter2 & " and 日期 >= #" & d & "# and 日期 < #" & d.addmonths(1) & "#")
'e.DataRow("M" & i) = sum
e.DataRow("M" & i) = sum + sum1
Next
Else
For i As Integer = 1 To 12
e.DataRow("M" & i) = Nothing
Next
End If
End If