📄 xuanke.asp
字号:
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>选课</title>
</head>
<body>
<%
dim conn,connstr
connstr="Driver={sql server};UID=sa;PWD=sa;database=zikao;server=BILLGATES"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from course "
rs.open sql,conn,3
%>
<table border="1" width="456" height="278">
<tr>
<td height="87" width="446" colspan="2">
<p align="center"><b><font size="7">学生选课</font></b></td>
</tr>
<form action="xuanke.asp" method="post">
<tr>
<td height="57" width="121">
<p align="right">课程名称</td>
<td height="57" width="319">
<p align="left"><select size="1" name="D1">
<%while not rs.eof%>
<option value="<%=rs(0)%>"><%=rs(1)%></option>
<%
rs.movenext
wend
rs.close
%>
</select></td>
</tr>
<tr>
<td height="62" width="446" colspan="2">
<p align="center"><input type="submit" value="提交" name="B1">
<input type="reset" value="重置" name="B2"></td>
</tr>
<tr>
<td height="53" width="446" colspan="2">
<%
if request.form("B1")="提交" then
sno=session("idstr")
cno=request("D1")
sql1="select * from course where courseno='"&cno&"'"
rs.open sql1,conn
set rs1=Server.CreateObject("ADODB.Recordset")
sql2="insert into chooseclass values( '"&rs(1)&"','"&rs(0)&"','"&sno&"','"&rs(2)&"','"&rs(3)&"')"
rs1.open sql2,conn
response.write "选课成功!"
end if
%>
</td>
</tr>
</form>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -