Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "SELECT * From {出库明细表}" dt = cmd.ExecuteReader() DataTables("订单明细表").DataRows("已交数") = dt.Compute("sum(实交数量)") ',"订单流水号 = '" & e.DataRow("订单流水号") & "' and 客户编号 = '" & e.DataRow("客户编号") & "'")