<%@ language=vbscript%> 
<%
Set Con= Server.CreateObject("ADODB.CONNECTION") 
 ConnString = "Provider=MicroSoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("shitiku.mdb")   
 Con.Open ConnString 
%>
 
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>在线练习</title>
</head><body>
<%
  Randomize 
  Set RS = Con.Execute("Select TOP 5 题号 FROM 试题表 orDER BY rnd(-(题号 +" &rnd() & "))") 
  %>
  
<%
Do While Not RS.EOF 
   response.Write RS.Fields("题号").Value & "<br/>" 
  
   RS.MoveNext 
  Loop 
  RS.Close 
  Set RS = Nothing 
  Con.Close 
  Set Con = Nothing  %></body></html>
我是新手,这段代码为什么只出题号,而不是一整条记录啊!帮忙改一下,access字段,题目,题号,1,2,3,4!先谢谢了!

解决方案 »

  1.   

    Select TOP 5 题号 FROM 试题表 
    改成:
    Select TOP 5 题号,其他字段1,其他字段2,... FROM 试题表
      

  2.   

      已解决
      经改正后代码如下:
      
      response.Write RS.Fields("题号").Value&"."
       response.Write RS.Fields("题目").Value & "<br/>"
      response.Write "A. " & RS(2) & "<br/>" 
      response.Write "B. " & RS(3) & "<br/>" 
      response.Write "C. " & RS(4) & "<br/>" 
      response.Write "D. " & RS(5) & "<br/>"