asp for循环显示问题求助
求助:为什么我的for循环显示结果,但换行时就会少一条记录,比如:有十二条数据,4条循环,则会出现这样的问题:第一行显示1,2,3,4第二行显示6,7,8,9第三行显示1...
求助:为什么我的for循环显示结果,但换行时就会少一条记录,比如:有十二条数据,4条循环,则会出现这样的问题:第一行显示1,2,3,4 第二行显示6,7,8,9 第三行显示11,12 为什么第5条,第10条数据不显示了呢 ?代码如下,求高手帮助修改,解惑!谢谢!
' 资讯新闻信息列表
' rows 行数
' titleLen 标题长度
' iconImg 图标文件
' showImgFlag 是否显示[图]标记
' showDate 是否显示发布时间
' channelID 所属频道
Sub ZixunNewsList(rows, titleLen, iconImg, showImgFlag, showDate, channelID, condition, orderBy)
Dim sql, rs
sql = "SELECT TOP " & rows & " * FROM " & ZIXUN_INFO_TABLE & " WHERE is_verified = 1 AND is_delete = 0 "
If channelID <> 0 Then
sql = sql & "AND channel_id IN (" & channelID & ")"
End If
If condition <> "" Then
sql = sql & " AND " & condition
End If
sql = sql & " ORDER BY " & orderBy &" DESC"
Set rs = conn.Execute(sql)
If rs.EOF Then
Response.Write("<tr><td>数据库无任何数据!</td></tr>")
Else
Do While Not rs.EOF
Response.Write("<tr>")
For j = 1 To 4
If rs.EOF Then Exit For
Response.Write("<td width='20' height='30' align='center'><img src='" & iconImg & "' /></td>")
Response.Write("<td align='left' style='font-size:14px;'><a href='ZixunShowNews.asp?id=" & rs("id") & "' title='" & rs("title") & "' target='_blank' class='link'>")
Response.Write(IndexgetShortStr(rs("title"), titleLen) & "</a></td>")
rs.MoveNext
i = i + 1
Next
Response.Write("</tr>")
rs.MoveNext
Loop
End If
End Sub 展开
' 资讯新闻信息列表
' rows 行数
' titleLen 标题长度
' iconImg 图标文件
' showImgFlag 是否显示[图]标记
' showDate 是否显示发布时间
' channelID 所属频道
Sub ZixunNewsList(rows, titleLen, iconImg, showImgFlag, showDate, channelID, condition, orderBy)
Dim sql, rs
sql = "SELECT TOP " & rows & " * FROM " & ZIXUN_INFO_TABLE & " WHERE is_verified = 1 AND is_delete = 0 "
If channelID <> 0 Then
sql = sql & "AND channel_id IN (" & channelID & ")"
End If
If condition <> "" Then
sql = sql & " AND " & condition
End If
sql = sql & " ORDER BY " & orderBy &" DESC"
Set rs = conn.Execute(sql)
If rs.EOF Then
Response.Write("<tr><td>数据库无任何数据!</td></tr>")
Else
Do While Not rs.EOF
Response.Write("<tr>")
For j = 1 To 4
If rs.EOF Then Exit For
Response.Write("<td width='20' height='30' align='center'><img src='" & iconImg & "' /></td>")
Response.Write("<td align='left' style='font-size:14px;'><a href='ZixunShowNews.asp?id=" & rs("id") & "' title='" & rs("title") & "' target='_blank' class='link'>")
Response.Write(IndexgetShortStr(rs("title"), titleLen) & "</a></td>")
rs.MoveNext
i = i + 1
Next
Response.Write("</tr>")
rs.MoveNext
Loop
End If
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询