addscorez.asp

来自「教务系统主要是老师和学生的一个平台」· ASP 代码 · 共 39 行

ASP
39
字号
<!--#include file ="connection.asp"-->
<%
	lessonno=request.Form("lessonno")
	xueqi=request.Form("xueqi")
	i=request.Form("scount")
	sqlstr="select * from 成绩 order by ID"
	set rs1=Server.CreateObject("ADODB.Recordset")
	rs1.open sqlstr,CN
	'response.write sqlstr
	'response.end 
	if rs1.eof then
	   scount=0
	else
	   scount=rs1("ID")+1
	end if 
	
	for j=0 to i-1
		sname="studentno"&j
		stuno=request.form(sname)
		scoreno="score"&j
		score=request.form(scoreno)
		
		sqlstr="select * from 成绩 where studentno='" & stuno &"' and lessonno='" & lessonno &"'"
		set rs=Server.CreateObject("ADODB.Recordset")
		rs.open sqlstr,CN
		
		if rs.eof then
			sqlstr="insert into 成绩 values("& scount &",'"
			sqlstr=sqlstr & stuno & "','"
			sqlstr=sqlstr & lessonno & "',"
			sqlstr=sqlstr & score & ",'"
			sqlstr=sqlstr & xueqi & "')"
		else
		   sqlstr="update 成绩 set score=" & score &" where studentno='" & stuno &"' and lessonno='" & lessonno &"'"
		end if
		CN.execute sqlstr
		scount=scount+1
	next
%>

⌨️ 快捷键说明

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