下面的代码有什么问题,谁知道的?

来源:百度知道 编辑:UC知道 时间:2024/09/24 13:13:45
下面输出的竟是同样的记录.而且序号都是一样的.
为什么?不知道哪里错了?

<form action=delmusic.asp?action=delmusic method=post name=delmusic>
<%
dim songname,singer,special,adddate,k,i,x
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from musiclist",conn,1,1
songname=rs("songname")
singer=rs("singer")
adddate=rs("adddate")
special=rs("special")
x=rs.recordcount
for i=1 to x
do while not rs.eof
%>
<tr>
<td width="47"><p align="center"><span style="font-size: 9pt"><%=i%></span>
</td>
<td width="7"><span style="font-size: 9pt"> </span></td>
<td width="161"><span style="font-size: 9pt"><%=songname%></span></td>
<td width="11&

你把这些
songname=rs("songname")
singer=rs("singer")
adddate=rs("adddate")
special=rs("special")
放到do while not rs.eof 后面就可以了。

只读一次,然后这些变量内容就再没变过……

你好像搞了个多重循环,更晕的是你在循环之前就把记录取出来了,呵呵
把songname=rs("songname")
singer=rs("singer")
adddate=rs("adddate")
special=rs("special")
放在循环体里就不会完全一样了!

rs.movefirst'********MOVE FIRST 很重要`
if not rs.eof 0r not rs.eof then
循环`
else
error
end if
如果你做分页的话`