<% dim sqlConn,strSql,strConn,sqlRS dim nPeopleCount session("gvmEventID") = "6" strConn = "Driver={SQL Server};Server=Server08;UID=user_web;PWD=724;Database=gvm" ''strConn = "Driver={SQL Server};Server=EASON-NB\SQLEXPRESS;UID=sa;PWD=spring;Database=gvm" ''取得目前參加人數 strSql = "select count(*) as PeopleCount from gvm_event_vote where eventid=6" set sqlConn = Server.CreateObject("ADODB.Connection") sqlConn.Open strConn set sqlRS = sqlConn.Execute(strSql) If sqlRS.EOF Then nPeopleCount = 0 Else nPeopleCount = trim(sqlRS("PeopleCount")) end if %>
<% ''產生投票前五名縣市表 strSql = "select top 5 b.countyname,count(votedata) as votecount from gvm_event_vote as a " & _ "inner join countyprofile as b on a.votedata = b.countyid where a.eventID=6 group by votedata,countyname order by votecount desc" set sqlRS = sqlConn.Execute(strSql) dim nNo,nVotecount nNo = 1 nVotecount = 0 do while not sqlRS.EOF response.Write "" 'response.Write "" response.Write "" nVoteCount = sqlRS("votecount") select case len(cstr(nVoteCount)) case 1 nVoteCount = "00000"+cstr(nVoteCount) case 2 nVoteCount = "0000"+cstr(nVoteCount) case 3 nVoteCount = "000"+cstr(nVoteCount) case 4 nVoteCount = "00"+cstr(nVoteCount) case 5 nVoteCount = "0"+cstr(nVoteCount) case 6 nVoteCount = cstr(nVoteCount) case else nVoteCount = "000000" end select response.Write "" response.Write "" nNo = nNo + 1 sqlRS.MoveNext loop sqlRS.Close sqlConn.Close %>
NO"& nNo &":"& sqlRS("countyname") &"
"& nVoteCount &"票
目前已有<%= nPeopleCount%>人挑戰PK!
http://www.gvm.com.tw/event/2010_Taiwan25/index.asp http://www.gvm.com.tw/event/2010_Taiwan25/index.asp
Copyright 1999~2010 天下遠見出版股份有限公司. All rights reserved.天下文化/遠見雜誌/小天下/30雜誌/《哈佛商業評論》全球繁體中文版
讀者服務部電話:(02)26620012 時間:週一∼週五 9:00∼17:00 服務信箱:gvm@cwgv.com.tw