页面要上有几个投票结果的显示,用"重复区域"显示多条结果,出现了记录为空的错误,以下是我的一些分析,求解
在页面开头,定义记录vTotal如下:
<%
Dim vTotal__MMColParam
vTotal__MMColParam = "1"
If (Request.QueryString("vote_id"
<> ""
Then
vTotal__MMColParam = Request.QueryString("vote_id"
End If
%>
<%
Dim vTotal
Dim vTotal_numRows
Set vTotal = Server.CreateObject("ADODB.Recordset"
vTotal.ActiveConnection = MM_connVoteSystem_STRING
vTotal.Source = "SELECT sum(vote_count) as vote_sum,max(vote_count) as vote_max FROM voteShow WHERE vote_id = " + Replace(vTotal__MMColParam, "'", "''"
+ ""
vTotal.CursorType = 0
vTotal.CursorLocation = 2
vTotal.LockType = 1
vTotal.Open()
vTotal_numRows = 0
%>
<%
Dim RecVote__MMColParam
RecVote__MMColParam = "1"
If (Request.QueryString("vote_id"
<> ""
Then
RecVote__MMColParam = Request.QueryString("vote_id"
End If
%>
通过vote_count(投票数)得出投票总数vote_sum,并求出投票最多的项目vote_max,放在vTotal中,里面有一条记录
然而,这样问题就来了,请看以下代码:
<%
While ((Repeat1__numRows <> 0) AND (NOT vTotal.EOF))
%>
<tr valign="baseline">
<td width="10" height="25"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><img src="images/arrow-2.gif" width="10" height="12" align="absmiddle"> </font></td>
<td><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><%=(RecVote.Fields.Item("vote_item"
.value)%></font></td>
<td width="220" height="25"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><img src="images/bar_g_h.gif" width="<%=(RecVote.Fields.Item("vote_per"
.value)%>" height="10" align="absmiddle"> <font color="#FF3300"><%=(RecVote.Fields.Item("vote_count"
.value)%></font></font></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
vTotal.MoveNext()
Wend
%>
以上错误代码,出现了记录集空的错误,AND (NOT vTotal.EOF)和vTotal.MoveNext()去掉后,没那个错误提示了,取出现了连续的10条同样地列表(设定显示数量为10).
若是去掉重复区域,也可以显示,但只有一条列表,我想是与vTotal有重大关系,希望大家帮忙分析一下