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

📄 tkpanduanupdate.asp

📁 在线考试系统
💻 ASP
字号:
<!---#include file="conn.asp"--->
<!-- args: categoryid,categoryname,oper,id--->
<%
oper=request.QueryString("oper")
categoryid=request.querystring("categoryid")
categoryname=request.querystring("categoryname")
if(oper="add") then
	Add
elseif(oper="del") then
	Del
elseif(oper="modify") then
	Modify
end if
if(rst<>null) then
	rst.close()
	set rst=nothing
end if
  set rst=nothing
  set conn=nothing
if(err)then
	response.Write("<SCRIPT language='javascript'>alert('操作失败,\n如有问题请联系管理员!');window.href='TKPanDuanAdd.asp'</script>")
else
	url="TKPanDuan.asp?categoryname="&categoryname&"&categoryid="&categoryid
	response.redirect(url)
end if

'添加判断题=============================================================
sub Add
question=request.Form("question")
set rst=conn.execute("select id from TKPanDuan where question='"&question&"'")
if rst.eof then
Insert
else
response.Write("<SCRIPT>alert('已有此题!');history.go(-1);</script>")
response.End()
end if
end sub
'入库操作
sub Insert
question=request.form("question")
answer=request.Form("answer")
if(question ="" or answer="" )then
response.write("<script>alert('题目不完整,请检查必填项!');history.go(-1);</script>")
response.end
end if
sql="insert into TKPanDuan values('"&question&"','"&answer&"',"&categoryid&")"
conn.execute(sql)
end sub
'修改判断题=============================================================
sub Modify
question=request.form("question")
set rst=conn.execute("select id from TKPanDuan where question='"&question&"'")
if rst.eof then
Update
else
	if(rst("id")=cint(request.QueryString("id"))) then
	Update 
	else
	response.Write("<SCRIPT>alert('已有此题!');history.go(-1);</script>")
	response.End()
	end if
end if
end sub
'更新操作
sub Update
id=request.querystring("id")
question=request.form("question")
answer=request.Form("answer")
if(question ="" or answer="" )then
response.write("<script>alert('题目不完整,请检查必填项!');history.go(-1);</script>")
response.end
end if
sql="update TKPanDuan set question='"&question&"',answer='"&answer&"' where id="&id
conn.execute(sql)
end sub


'删除判断题=============================================================
sub Del
	id=request.querystring("id")
	sql="delete from TKPanDuan where id="&id
	conn.execute(sql)
end sub
%>

⌨️ 快捷键说明

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