<%
set rdds=server.createobject("adodb.recordset")
sql="select * from lsb where hymc='"&session("siteyhm")&"'"
rdds.open sql,conn,1,1
do while not rdds.eof
response.Write ""&rdds("hyjg")&"+" 可以循环 取出数据2+3+4+5+
rdds.movenext
loop
response.Write(1)
%>
set rdds=server.createobject("adodb.recordset")
sql="select * from lsb where hymc='"&session("siteyhm")&"'"
rdds.open sql,conn,1,1
sum=0
i=1
do while not rdds.eof
i=i+1
sum=sum+cint(rdds("hyjg"))
rdds.movenext
loop
response.Writesum
set rdds=server.createobject("adodb.recordset")
"slect SUM(hyjg) as he from lsb where hymc='"&session("siteyhm")&'"
rdds.open sql,conn,1,1
response.Write he
有兴趣的话,你可以用SQL求和试试,能省不少代码,而且很好玩!注意字段匹配就对了hyjg必须是字段类型为数字!