vb 中 如何获得datagrid 一列值求和
展开全部
select sum("列名") from table where 字符名=条件
===========
Private Sub Command1_Click()
For Count = 0 To Adodc2.Recordset.RecordCount - 1
Lcount = Lcount + Val(DataGrid2.Column("商品消费总数").Text)
DataGrid2.Row = DataGrid2.Row + 1
Next Count
End Sub
===========
Private Sub Command1_Click()
For Count = 0 To Adodc2.Recordset.RecordCount - 1
Lcount = Lcount + Val(DataGrid2.Column("商品消费总数").Text)
DataGrid2.Row = DataGrid2.Row + 1
Next Count
End Sub
追问
报错 说是 行号无效
追答
Private Sub Command1_Click()
DataGrid2.Row=1
For Count = 0 To Adodc2.Recordset.RecordCount - 1
Lcount = Lcount + Val(DataGrid2.Column("商品消费总数").Text)
DataGrid2.Row = DataGrid2.Row + 1
Next Count
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询