我用ASP操作Access数据库时用do while循环显示数据时,数据库里面查询出来有3条数据,但是页面上每条数据会显示2次?不知道什么原因。
exec="select * from User_d where lei=1 and sh=0 order by jdldata desc"
set cc=server.createobject("adodb.recordset")
cc.open exec,conn,1,3
num=cc.RecordCount
i=0
if not cc.eof then
do while not cc.eof
hao=cc("hao")
xxx="select count(*) as a from User_d where lei=1 and sh=0 and hao<" & hao
set ccc=server.createobject("adodb.recordset")
ccc.open xxx,conn,1,3
%>
<tr class="STYLE3">
<td width="62" class="p12"><%=cc("CardNum")%></td><td width="89" class="p12"><%=cc("username")%></td><td width="99" class="p12"><%=ccc("a")%></td>
</tr>
<%
cc.movenext
loop
end if
%>
------解决方案--------------------
试试xxx="select distinct count(*) as a from User_d where lei=1 and sh=0 and hao<" & hao
------解决方案--------------------
你在
do while
loop
里面加response.write 语句排查一下不就知道了