VB编程,有二个字段,状态描述和数量,我想统计不同状态的总数量,如何写语句
rs.Open"select*from计划",cnn,3,1zt=""DoWhileNotrs.EOFMe.MSFlexGrid1.TextMatrix(TotalRow...
rs.Open "select * from 计划", cnn, 3, 1
zt = ""
Do While Not rs.EOF
Me.MSFlexGrid1.TextMatrix(TotalRow, 0) = TotalRow
If zt <> rs("状态描述") Then
zth = zth + 1
zt = rs("状态描述")
Nom = rs("数量")
Me.MSFlexGrid1.TextMatrix(i, 1) = zt
Me.MSFlexGrid1.TextMatrix(i, 2) = Nom
Me.MSFlexGrid1.TextMatrix(i, 3) = zth
i = i + 1
TotalRow = TotalRow + 1
Else
Me.MSFlexGrid1.TextMatrix(i - 1, 2) = Nom +rs(“数量”)
End If
rs.MoveNext
Loop
这种方法不行 展开
zt = ""
Do While Not rs.EOF
Me.MSFlexGrid1.TextMatrix(TotalRow, 0) = TotalRow
If zt <> rs("状态描述") Then
zth = zth + 1
zt = rs("状态描述")
Nom = rs("数量")
Me.MSFlexGrid1.TextMatrix(i, 1) = zt
Me.MSFlexGrid1.TextMatrix(i, 2) = Nom
Me.MSFlexGrid1.TextMatrix(i, 3) = zth
i = i + 1
TotalRow = TotalRow + 1
Else
Me.MSFlexGrid1.TextMatrix(i - 1, 2) = Nom +rs(“数量”)
End If
rs.MoveNext
Loop
这种方法不行 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询