网络考场(16)(转)tselectsub.asp
<%@ Language=VBScript %><%Response.Buffer=true%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY bgColor=Azure>
<%
if Request.QueryString("act")="add" then
'如果请求加入试题内容,则form1提交的页面为taddquestion.asp
Response.Write "<FORM action=taddquestion.asp method=POST id=form1 name=form1>"
else
'如果请求修改试题内容,则form1提交的页面为teditquestion.asp
Response.Write "<FORM action=teditquestion.asp method=POST id=form1 name=form1>"
end if
%>
<P>选择所要修改/加入题目的课程</P>
<P><SELECT id=select1 name=selsub
style="HEIGHT: 21px; WIDTH: 204px">
<%
set conn=server.CreateObject("adodb.connection")
conn.ConnectionString="dsn=testsys"
conn.Open
'从存储课程的表subinfo中选择teachid等于当前教师编号的记录
strsql="select * from subinfo where teachid='" & session("teachid") & "'"
set mrs=conn.Execute(strsql)
while not mrs.eof
'将所有的课程加入到select中
Response.Write "<OPTION>" & mrs("sub")
mrs.movenext
wend
'关闭并清空数据库连接对象
conn.Close
set conn=nothing
%>
</SELECT>
<INPUT id=submit1 name=submit type=submit value=确定></P>
</FORM>
</BODY>
</HTML>
补充:asp教程,高级应用