Dim rk As Integer
Dim cmd As New SQLCommandcmd.CommandText = "SELECT SUM(数量) form {收付存} where 物资代码 = '" & dr("物资代码") & "' and 库存类别 = '" & "入库" & "'"
rk = cmd.ExecuteScalar()
其实在帮助有现成的例子可以套用的,呵呵