萬盛學電腦網

 萬盛學電腦網 >> 網頁制作 >> dreamweaver教程 >> 如何應用CDbl()函數實現年度新聞人物評選

如何應用CDbl()函數實現年度新聞人物評選

  <!-- #include file="Conn/conn.asp" --> 
    <% sql="select sum(Numbers) as sum from tb_Vote" 
    rs.open sql,conn 
    If not rs.eof then 
         sum=rs("sum") 
    end If 
    set rs=nothing 
    conn.close 
    set conn=nothing 
    %> 
    <table height="20" border="0" cellpadding="0" cellspacing="0"> 
    <tr> 
    <td width="50">支持率:</td> 
    <% i=round(100*cdbl(rs("Numbers"))/cdbl(sum),2)%> 
    <td width="252" valign=middle><img src="Image/vote.gif" width="<%=i%>%" height="15" alt="">&nbsp;</td> 
    <td width="48" valign=middle>&nbsp;<%=i%>%</td> 
    <td width="67"><div align="center"><%=rs("Numbers")%>票</div></td> 
    </tr> 
    </table>

copyright © 萬盛學電腦網 all rights reserved