蛟龙号发现了什么生物:在asp中怎么对已查出的数据库记录集进行求和,sql语句该怎么写?

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/28 20:31:45
zglx=Request.QueryString("zglx")
StrSQL="select * from 在职工资表 where 工种='"&zglx&"' Order By 编号 asc"
rs.Open StrSQL,conn,adOpenStatic,adLockReadOnly,adCmdText
zwgz=sum(rs("职务工资"))
response.Write(zwgz) 这是代码,但sum不能用呀。

do while not es.eof
zwgz=zwgz+rs("职务工资")
rs.movenext
loop
多简单!

StrSQL="select sum(职务工资) as 工资 ,字段名 from 在职工资表 where 工种='"&zglx&"' Order By 编号 asc"
就可以了

StrSQL="select sum(职务工资) from 在职工资表 where 工种='"&zglx&"' Order By 编号 asc"
这样改,然后用response.write rs(0)就能显示了!