在function中使用recordset对象

function GetTotalFee(rsObj)
set rs = rsobj


allsum 
= 0
rs.Movefirst

while not rs.eof 
      daysum 
=0
      
for i=6 to rs.fields.count-8
      
if instr(lcase(rs.fields(i).name),"remark")=0 then
        
if Not IsNull(rs(rs.fields(i).name)) then 
            
if cint(trim(rs(rs.fields(i).name)))<>0 then
                daysum
=daysum+cint(trim(rs(rs.fields(i).name)))
                
'Response.write daysum&"<br>"

            
end if
        
end if
      
end if

      
next

      allsum 
= allsum + cint(daysum)

 
rs.MoveNext

wend
GetTotalFee 
= allsum
end function

sql_display="select * from expense where fileno ='"&strBH&"' order by expenseDate asc"
    

    
set objDisplay=conn.execute(sql_display)

调用
 <%=GetTotalFee(objDisplay) %>
原文地址:https://www.cnblogs.com/king_astar/p/50601.html