selected.asp

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

ASP
57
字号
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="adovbs.inc"-->
<!--#include file="connection.asp"-->
<%
Selected=Split(Session("checkbox"),",")
Set rsTest=Server.CreateObject("ADODB.RecordSet")
rsTest.Open "Course",Conn,adOpenkeySet,adLockOptimistic',adCmdText
Set rsStudent=Server.CreateObject("ADODB.RecordSet")
StrSQL="Select * From Selection Where Studentno='"&Session("Userno")&"' "
rsStudent.Open StrSQL,Conn,adOpenkeySet,adLockOptimistic,adCmdText
For i=0 To Ubound(Selected)
	Do While Not rsTest.EOF 
		If rsTest("Courseno").Value=Trim(Selected(i)) Then
    		rsTest("Currentnum")=rsTest("Currentnum").Value+1
			Test=0
			If rsStudent.RecordCount=0 Then
			Else
			Do while not rsStudent.EOF 	  			
				If Trim(rsStudent("Courseno").Value)=Trim(Selected(i)) Then
					Test=1
				End If
				rsStudent.MoveNext
			loop
			rsStudent.MoveFirst
			End If
			if Test=0 Then
				rsStudent.AddNew
				rsStudent("Studentno")=Session("Userno")
				rsStudent("Courseno")=Trim(Selected(i))
				rsTest.UpdateBatch	
			Else
				Response.Redirect "SelectedError.asp"
			End If
			rsStudent.UpdateBatch
		End If
		rsTest.MoveNext
	Loop
	rsTest.MoveFirst
Next
rsTest.Close		
rsStudent.Close
Conn.Close
Set rsTest=Nothing
Set rsStudent=Nothing
Set Conn=Nothing
%>
<html>
<body>
<div align="center">
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p><font color="#FF0000" size="+7" face="华文新魏">所选课程信息已保存!</font></p>
<p align="center"><a href="main.asp">返回</a></p>
</div>	
</body>

⌨️ 快捷键说明

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