下面的代码怎么会是死循环?
for i=1 to multicount
randomize
sql="select * from exam_database where subject='"& subject &"' and type='多选题'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
counts=rs.recordcount
temp=fix(counts*rnd)
do while instr(str,temp)>0
randomize
temp=fix(rnd*counts)
loop
str=str&"*^"&temp
rs.move temp
%>
<input type="hidden" value="<%=rs("id")%>" name="id">
<tr>
<td width="100%" colspan=2 bgcolor="#EFEFEF" height="20"><b><%=i%>、<%=rs("question")%>( )</b></td>
</tr>
<%
if rs("text1")<>"" then
%>
<tr>
<td colspan=2 width="100%">A、<%=rs("text1")%></td>
</tr>
<%
end if
%> <%
if rs("text2")<>"" then
%>
<tr>
<td colspan=2 width="100%">B、<%=rs("text2")%></td>
</tr>
<%
end if
%> <%
if rs("text3")<>"" then
%>
<tr>
<td colspan=2 width="100%">C、<%=rs("text3")%></td>
</tr>
<%
end if
%> <%
if rs("text4")<>"" then
%>
<tr>
<td colspan=2 width="100%">D、<%=rs("text4")%></td>
</tr>
<%
end if
%> <%
if rs("text5")<>"" then
%>
<tr>
<td colspan=2 width="100%">E、<%=rs("text5")%></td>
</tr>
<%
end if
%> <%
if rs("text6")<>"" then
%>
<tr>
<td colspan=2 width="100%">F、<%=rs("text6")%></td>
</tr>
<%
end if
%>
<%
j=j+1
next
rs.close
set rs=nothing
end if%>
问题点数:50、回复次数:2Top
1 楼superdullwolf(超级大笨狼,每天要自强,MVP)回复于 2006-03-04 00:32:18 得分 0
Sql server :
select top 10 * from 表 order by newid();
Access:
select top 10 * from 表 order by rnd(id)Top
2 楼iuhxq(小灰)回复于 2006-03-04 01:18:08 得分 0
同意楼上
深夜访问CSDN真快啊Top




