这是ASP做电脑派位系统,其中的派位过程。   下面是青岛三中的一志愿招生人数小于报名人数,所以需要随机抽取学生。a1 是报名人数 B1是招生人数,高手来看看这么做对不?还有什么好办法?
<%       
        if a1<=d1  then
          sql="select * from student where fwish = '青岛三中' "
          rs.open sql,conn,1,3
          if rs.eof then
                response.Write("暂无信息,请联系管理员")
                response.End()
          end if
       
          rs.movefirst
          
       
          do until rs.eof             

           rs("fstate")=1
                   rs.movenext
       loop
          rs.close
        else
          sql="select * from student where fwish = '青岛三中' "
          rs.open sql,conn,1,3
          if rs.eof then
                response.Write("暂无信息,请联系管理员")
                response.End()
          end if
           dim shu1(100)
       flag=false
       i=1
       while(i<=d1)
        x=RndNumber(a1,1)
        j=1
         while(j<i)
         if shu1(j)=x then flag=true
         j=j+1
         wend
         if not flag then
         shu1(i)=x
         i=i+1
        else
         flag=false
       end if
       wend
   
   
     for i=1 to d1
                    
           rs.movefirst
           do until rs.eof
        if rs("number")=shu1(i) then
               rs("fstate")=1
               
            end if
           rs.movenext
           loop
          
     next
        rs.close             
         
end if