classchoice.asp

来自「《动态网页设计基础教程》,胡杰,科学出版社」· ASP 代码 · 共 118 行

ASP
118
字号
<!-- #include file="adoconn.asp" -->
<%
Dim temprs,checksql
IF request.form("B1")="保存" then 
    
    for each item in request("Selected") 
        checksql="Select ClassNo from ClassofTeacher where Tid='" & session("Tid") & "' and ClassNo='" & item & "' and Yeartoyear='" & session("Termyear") & "' and Term='" & session("Term") & "'"
        Set rs=GetRecordset(checksql)
        if rs.Eof then
           Set Adoconn=nothing
           Adoconnection()
           Adoconn.Execute "Insert into ClassofTeacher values('" & session("Tid") & "','" & Session("Tname") & "','" & item & "','" & Session("forCollege") & "','" & Session("Termyear") & "','" & Session("Term") & "')" 
           set Adoconn=nothing
        else
           Set Adoconn=nothing
        end if
    next 
     
%>
<script language="vbscript">
        History.back
        History.back
</script>
<%
END IF
%>
<html>

<head>
<link rel="stylesheet" href="comCSS.css">
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>授课班级选择</title>
<base target="rbottom">
<meta name="Microsoft Border" content="t, default">
</head>

<script language="vbscript" for="B2" event="onclick">
        History.back
</script>

<body ><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td>

<p align="left"> </p>

</td></tr><!--msnavigation--></table><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><!--msnavigation--><td valign="top"> 
<% 
Dim sql 
Dim reccount 
Dim fieldi,recordi 
Dim ps,mypagesize,ys,mypage 
Dim maxcount 

Session("forCollege")=request.form("D1")
SQL="select * from ClassNo where College='" & Session("forCollege") & "' ORDER BY College"

Set rs=GetRecordset(sql)
 
IF not rs.eof then  
   Reccount=rs.RecordCount
ELSE
   Set rs=nothing      
   Set Adoconn=nothing      
%>
<script language="vbscript">
   MsgBox "无班级号!"     
   History.back
</script>
<%
END IF 
%> 
 
<%scriptname=request.servervariables("script_name")%>  


<form method="post" action=<%=scriptname%> > 
<table border=0 cellspacing="0" width="245"> 
<tr> 
<td><font face="华文行楷" size="4" color="#FF0000"><b>选择授课班级</b></font><b><font face="华文新魏" size="4" color="#FF0000">:</font></b><font face="华文行楷" size="4" color="#FF0000"><b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  </b></font><input type="submit" value="保存" name="B1"><input type="button" value="返回" name="B2"></td>                
</table>                                           
<div align="left" style="width: 497; height: 45">                
  <table border="1" width="245" height="46">              
  <tr bgcolor=#ccccc7>            
    <td width="239" align="center" height="21">              
        <p align="center"><font color="#000080"><b>&nbsp;班级代码 </b></font>     
    </td>          
   </tr>     
         
    <%for recordi=1 to Reccount        
      if rs.Eof then Exit for        
      if recordi mod 2=0 then     
         color="#ddddd7"     
      else     
         color="#eeeeef"     
      end if     
      response.write ("<tr bgcolor=" + color +">")  
    %>  
 
      <td width="239"><input type="checkbox" name="Selected" value="<%=rs(0) %>"><%=rs(0) %></td>          
           
    <%response.write ("</tr>")%>          
    <% rs.movenext%>          
    <%next%>          
  </table>        
</div>          
<%      
  Set rs=nothing      
  Set Adoconn=nothing      
%>                         
         
</form>         

 <!--msnavigation--></td></tr><!--msnavigation--></table></body>       
</html>              

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?