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

📄 save_try_add.asp

📁 这是一个用ASP写的在线考试系统.特别一点 就是考试试卷有两种考法,一种为系统自动出卷,另一种是老师出卷考试.前者的实现是参考网上代码.总的来说还是很值得参考的.
💻 ASP
字号:


<!--#include file="conn2.asp"-->

<%
'addId=request("addId")
'addid=Cint(addid)
addname=request.QueryString("addname")

'Session("addnamet")=addname
'tryInfoSql="select * from tryInfo1 where id= "&addid             
'set rsT=conn.execute(tryInfoSql)


 
'db_name=rst("db_name")
'mon=trim(rst("db_modfiyflag"))
'onfo=trim(rst("db_onofft"))
'tryinfosql="select "


tryId=request("id")
tryselectT=request("selectT")

trycent=trim(request("cent"))
trycent=Cint(trycent)
trysubject=trim(request("subject"))
tryselectQ=UCase(trim(request("selectQ")))

if tryselectT<>"1" then 
	tryselectQL=Len(tryselectQ)
	for i=1 to tryselectQL
		tryselectQOne=Mid(tryselectQ,i,1)
		'验证重复字符
		for j=2 to tryselectQL
			TempNum=tryselectT     'inStr(i,tryselectQ,tryselectQOne)
			if TempNum=2 then
				session("sa_help")="记录添加失败,"&tryselectQ&"是非法答案(内有重复),请重试!"
				response.Redirect("try_add.asp")
			end if
		next
		'验证字符是否在ABCD内
		if tryselectQOne>"D" or tryselectQOne<"A" then
			session("sa_help")="记录添加失败,"&tryselectQ&"是非法答案(不是ABCD),请重试!"
			response.Redirect("try_add.asp")
		end if		
	next	
	tryselA=request("selA")
	tryselB=request("selB")
	tryselC=request("selC")
	tryselD=request("selD")
	insertSql="insert into "&Session("addnamet")&"  values("&tryid&",'"&tryselectT&"','1',"&trycent&",'"&trysubject&"','"&tryselA&"','"&tryselB&"','"&tryselC&"','"&tryselD&"','"&tryselectQ&"','0') "
else
	if tryselectQ<>"A" and tryselectQ<>"B" then
		session("sa_help")="记录添加失败,请在判断题答案中添加“A”或“B”!"
		response.Redirect("try_add.asp")
	end if
	if tryselectQ="A" then
		tryselectQ="1"
	else 
		tryselectQ="0"
	end if
	insertSql="insert into "&Session("addnamet")&"  values("&tryid&",'"&tryselectT&"','1',"&trycent&",'"&trysubject&"','','','','','"&tryselectQ&"','0') "
end if
'response.write(insertSql)
'response.end()
set rsT=conn.execute(insertSql)
session("sa_help")="上条记录添加完毕!"
response.Redirect("try_add.asp")
%>

⌨️ 快捷键说明

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