⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chkpre.asp

📁 学生可根据自己喜欢的课程进行选课
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="xuanke.asp" -->
<!--#include file="include/is_user.asp" -->
<!--#include file="include/exit.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
@import url("style.css");
.STYLE1 {color: #FF0000}
body {
	background-image: url(image/back.jpg);
}
-->
</style>
</head>

<%
dim p_cno,p_cname,p_name,p_id_no,p_classes,err(2)
dim rs_save,rs_preengage,rs_test_no,rs_student,rs_c,rs_time



'接收预约信息----------------------
p_cno=request("cno")
cday=request.Form("cday")
cctime=request.Form("cctime")
p_id_no=request("p_id_no")
p_csno=request("p_csno")
p_zhiyuan=request.Form("p_zhiyuan")

%>

<body>
<div align="center">
  <table width="760" border="0" class="table_big">
    <tr>
      <td valign="top"><div align="center">
        <!--#include file="include/head.asp" -->
        <%	set rs_c=server.CreateObject("adodb.recordset")
	      sql = "select * from preengage where p_cno = '" & request("cno") & "'"
		  sql=sql+"and p_id_no='"&request("p_id_no")&"'"
		rs_c.open sql,xuanke_conn,3,2
	 if (rs_c.eof or rs_c.bof) then
		
		
		
		set rs_test_no=server.CreateObject("adodb.recordset")
	sql = "select * from preengage where p_id_no='" & request("p_id_no") & "'"
		rs_test_no.open sql,xuanke_conn,3,2
		if not(rs_test_no.eof or rs_test_no.bof) then
		
		Set rs_preengage = Server.CreateObject("ADODB.Recordset")
              sql = "SELECT * FROM preengage where p_id_no ='" & request("p_id_no") & "'"
             rs_preengage.Open sql,xuanke_conn,3,2
			 
	
	If (rs_preengage.RecordCount = -1) Then
	             rs_preengage_total=0
	              rs_preengage.movefirst
	         While (Not rs_preengage.EOF)
			 
		      rs_preengage_total = rs_preengage_total + 1
		   rs_preengage.MoveNext
	          Wend
	   else
	rs_preengage_total = rs_preengage.RecordCount
   End If
   
   
	
	
 if (rs_preengage_total>=rs_test_no("p_limte")) then 

%>

 <table width="450" border="0" class="table_small">
          <tr>
            <td background="image/type_bg.gif">&nbsp;</td>
          </tr>
          <tr>
		  
            <td class="text_title"><div align="left">你只能选两门课程!</div></td>
          </tr>
          <tr>
            <td class="table_title">&nbsp;</td>
          </tr>
          <tr>          </tr>
          <tr>
            <td class="text"><div align="center">[<a href="course.asp">返回</a>]</div></td>
          </tr>
		 <%else%>
		 <%
		 
		 
		    rs_test_no.movefirst
			while(not rs_test_no.eof or rs_test_no.bof)
		 if(rs_test_no("p_zhiyuan")=int(p_zhiyuan)) then
			    response.Redirect("error3.asp")
				end if
		 rs_test_no.movenext
		    wend
		 
		 
		 
		 
		    rs_test_no.movefirst
		set rs_class_no=server.CreateObject("adodb.recordset")
	    sql = "select * from class where id=" & rs_test_no("p_csno")
		rs_class_no.open sql,xuanke_conn,3,2
		
		  if (rs_class_no("cday")=int(cday) and rs_class_no("cctime")<=int(cctime) and (rs_class_no("cctime")+2)>int(cctime))  or (rs_class_no("cday")=int(cday) and rs_class_no("cctime")<int(cctime)+2 and rs_class_no("cctime")+2>=int(cctime)+2) then
		   
		   response.Write("●你选的课和你以前选的课有时间冲突!")
		   
		   else
		 
			'将预约写入数据库--------------
		  
				set rs_save=server.CreateObject("adodb.recordset")
				sql = "select * from preengage"
				rs_save.open sql,xuanke_conn,3,2
				
														
				rs_save.addnew
				rs_save("p_cno")=p_cno
				rs_save("p_id_no")=p_id_no
				rs_save("p_csno")=p_csno
				rs_save("p_zhiyuan")=p_zhiyuan
				rs_save.update
				rs_save.movelast
				
			%>		
			
				
				
		  <%= "<title>预约成功</title>" %>
		  <br>
          <table width="400" border="0" class="table_small">
            <tr>
              <td width="199">&nbsp;</td>
            </tr>
            <tr>
              <td class="text_title"><div align="center">预约成功!</div></td>
            </tr>
            <tr>
              <td class="table_title">&nbsp;</td>
            </tr>
            
            <tr>
              <td class="text"><div align="center">[<a href="index.asp">返回</a>]</div></td>
            </tr>
            <tr>
              <td class="text">&nbsp;</td>
            </tr>
          </table>
		<%end if%>
		<%end if%>
         <br>
        </table>
		
		
		
		
		
       <%else%>
	<%
			'将预约写入数据库--------------
		  
				set rs_save=server.CreateObject("adodb.recordset")
				sql = "select * from preengage"
				rs_save.open sql,xuanke_conn,3,2
				
				rs_save.addnew
				rs_save("p_cno")=p_cno
				rs_save("p_id_no")=p_id_no
				rs_save("p_csno")=p_csno
				rs_save("p_zhiyuan")=p_zhiyuan
				rs_save.update
				rs_save.movelast
			%>		
			
				
				
		  <%= "<title>预约成功</title>" %>
		  <br>
          <table width="400" border="0" class="table_small">
            <tr>
              <td width="199" background="image/type_bg.gif">&nbsp;</td>
            </tr>
            <tr>
			
	
              <td class="text_title"><div align="center">预约成功!</div></td>
            </tr>
            <tr>
              <td class="table_title">&nbsp;</td>
            </tr>
            
            <tr>
              <td class="text"><div align="center">[<a href="course.asp">返回</a>]</div></td>
            </tr>
            <tr>
              <td class="text">&nbsp;</td>
            </tr>
          </table> 
		<%end if%>
         <br>
		<%else%>
		 
		  <tr>            </tr>
		  <table width="374" border="0">
            <tr>
              <td width="368"><span class="STYLE1">对不起,你已选过同种类型的课,请选择其他课程</span></td>
            </tr>
			<%end if%>
          </table>
	
		
		
		  <!--#include file="include/foot.asp" -->
  
		    
			
			<br>
      </div></td> 
    </tr>
  </table>
</div>



</body>

</html>

⌨️ 快捷键说明

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