[求助] 显示基数个记录就出现错误,偶数个正常,如何解决,显示两行四列???

gxl598 2003-09-08 12:59:49
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/bbsbak.asp" -->

<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = "dsn=SQL Server;uid=sa;pwd=123456789;"
Recordset1.Source = "SELECT * FROM dbo.bxdlr"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 4
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>保险代理人</title>

</head>

<body background="images/bg.gif" link="#000000" vlink="#000000" alink="#000000" marginheight="0">
<TABLE WIDTH=780 BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
<TR>
<TD rowspan="6" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<td><table width="97%" height="179" border="0" align="center" cellpadding="0" cellspacing="0">
<%
do while not Recordset1.eof
%> <tr>

<td height="129"> <div align="center"><a href="<%=(Recordset1.Fields.Item("mb").Value)%>?userid=<%=(Recordset1.Fields.Item("userid").Value)%>" target="_blank"><img src="<%=(Recordset1.Fields.Item("userphoto").Value)%>" alt="userphoto" width="82" height="104" border="1"></a></div></td>
</tr>
<tr>
<td height="25" align="left" valign="middle"> <div align="center"><%=(Recordset1.Fields.Item("nicheng").Value)%></div></td>
</tr>
<tr>
<td height="25" align="left" valign="middle"> <div align="center">人气指数<%=(Recordset1.Fields.Item("click").Value)%></div></td>
</tr>
<%
i=i+1
if (i mod 2=0) then
exit do

response.write "<tr><td> </td></tr>"
end if
Recordset1.movenext
loop
%>
</table></td>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</tr>
</table></td>
</tr>
</table></TD>
</TR>
</TABLE>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
...全文
46 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
gxl598 2003-09-08
  • 打赏
  • 举报
回复
求助!!!!
gxl598 2003-09-08
  • 打赏
  • 举报
回复
求助高手帮助!!!!!!!!!!!!!!
gxl598 2003-09-08
  • 打赏
  • 举报
回复

演示: http://ghs.com.cn/bxdlr.asp

显示基数个记录就出现错误,偶数个正常,如何解决,显示两行四列???

如果记录增加到8条,显示正常.
1981520baby 2003-09-08
  • 打赏
  • 举报
回复
注意 rs.eof

一不小心就到底了。。
coffee_cn 2003-09-08
  • 打赏
  • 举报
回复
if Recordset1.eof then exit do
你要在适当位置加上

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧