答案:<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<P align=center><FONT color=crimson face=幼圆
size=4><STRONG>选择要查看的课程</STRONG></FONT></P>
<P align=center>
<TABLE border=1 cellPadding=1 cellSpacing=1 width=75%>
<TR>
<TD>课程名称</TD>
<TD>开课老师</TD>
</TR>
<%
'创建数据库连接对象
set conn=server.CreateObject("adodb.connection")
conn.ConnectionString="dsn=testsys"
conn.Open
'定义sql语句,从数据库查询已有学生考试的科目
strsql="select distinct score.sub,score.teachid,teacherinfo.teachname from score,teacherinfo where score.teachid=teacherinfo.teachid"
set mrs=conn.Execute(strsql)
while not mrs.eof
'以表格的形式显示各个考试科目
Response.Write "<TR>"
Response.Write "<TD>"
Response.Write "<a href=> Response.Write "</TD>"
Response.Write "<TD>" & mrs("teachname") & "</TD>"
Response.Write "</TR>"
mrs.movenext
wend
'关闭数据库连接对象
conn.Close
'清空对象变量
set conn=nothing
%>
</TABLE></P>
<P> </P>
</BODY>
</HTML>
上一个:网络考场(14)(转)tleft.asp
下一个:用ASP+XML打造留言本 - 4