Dim cmd As New SQLCommandDim dt As DataTable
cmd.CommandText = "SEL ECT sum(a.数量) as 货物总量 From ({合同明细表} a inner join ({合同表} b inner join {客户表} c on b.客户名称 = c.客户名称) on a.合同编号 = b.合同编号 where c.客户名称 = 'xxxxxx' and c.年份 = xxxx"dt = cmd.ExecuteReader()
Output.Show(dt.DataRows(0)("货物总量"))