Dim dr As DataRow = e.DataRow Dim dt As DataTable =DataTables("仓库") If e.DataCol.Name = "产品名称" And dr.IsNull("产品名称") = False Then dr("状态_y") = dt.Compute("sum(数量)","[产品名称] = '" & dr("产品名称") & "'" And "[状态] = '" & dr("状态_y") & "=y""'") dr("状态_n") = dt.Compute("sum(数量)","[产品名称] = '" & dr("产品名称") & "'"And "[状态] = '" & dr("状态_n") & "=n""'") End If