sql="select * from SUBJECT"
call crecset(sql,conn2,rs,3,3)
do while not rs.bof and not rs.eof%>
<option value="<%=rs("SID")%>" <%if request.Form("sid")=rs("SID") then response.Write("selected") end if%>><%=rs("SNAME")%></option>
<%
rs.movenext
loop
call srecset(rs)
%>
</select>
<br>
<span class="font1"> 班级:</span>
<select name="classid" class="sel" >
<%
if not request.form("sid")="" then
'call cconn("dbase/search.mdb",conn,"","")
sql="select * from CLASS where SID='"&request.Form("sid")&"'"
call crecset(sql,conn2,rs,3,1)
do while not rs.bof and not rs.eof
%>
<option value="<%=rs("CID")%>"><%=rs("CNAME")%></option>
<%rs.movenext
loop
call srecset(rs)
else%>
<option value="">请先选择专业</option>
<%
最土的做法
先把大类求出来,然后在大类里面循环的时候再逐一把小类求出来
<%
sql="select id,name from 大类 order by 排序"
rs.open sql,cn,1,1
do while not rs.eof
response.write "<options value="&rs("id")&">"&rs("name")&"</options>"
sql1="select id1,name1 from 小类 where 所属大类id='"&rs("id")&"' order by 排序"
rs1.open sql1,cn,1,1
do while not rs1.eof
response.write "<options value="&rs1("id1")&">"&rs1("name1")&"</options>"
rs1.movenext
loop
rs1.close
rs.movenext
loop
rs.close()
%>