[分享]给大家贴一个随机出题的代码
hyjia 2006-05-12 01:55:44 大家还有什么好的方法,贴出来看看.
response.Write "一.单选题("&numtype1&"个×"&marktype1&"分)<br/>"
i=0
j=0
dim tarray(20)
sql="select * from 试题 where 类型=1"
rs.open sql,conn,1,1
'response.End()
'''''''''''''''''''''''''''''''''''''''''''''实现不重复出题的关键代码''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''2006-4-30 16:56
while(numtype1>0)
randomize
a=int(maxtype1*rnd+1)
doublequ=0
rs.movefirst
rs.move a
for each qu in tarray
if qu=rs("编号") then
doublequ=1
exit for
end if
next
if doublequ=0 then
response.Write j+1&") "&rs("题目")&"<br/>"
tarray(j)=rs("编号")
j=j+1
numtype1=numtype1-1
end if
'rs.movefirst
wend
'''''''''''''''''''''''''''''''''''''''''''''''hyjia''''''''''''''''''''''''''''''''''''''''''''
rs.close