admincreatepaper3.asp
来自「网络考试系统最终备份」· ASP 代码 · 共 807 行 · 第 1/2 页
ASP
807 行
set rs=nothing
end if
'选出符合条件的判断题
sql1="select * from question_database where Que_Type=2 and Sub_ID="&v_subjectid&" and DiffRate=1 and QueMark=0 and Knowledge_ID in ("&knowledgearray(0)&","&knowledgearray(1)&","&knowledgearray(2)&","&knowledgearray(3)&","&knowledgearray(4)&","&knowledgearray(5)&","&knowledgearray(6)&","&knowledgearray(7)&")"
set rs1=server.createobject("adodb.recordset")
rs1.open sql1,conn,3,2
for iCount=1 to (v_judgecount*r1/100)
'count1=rs1.recordcount
'temp=fix(count1*rnd)+1
'while temp <= 0 or temp >=count1
'temp=fix(count1*rnd)
' wend
if not rs1.eof then
Ques(ACount)=rs1("QueID")
Questype(ACount)=rs1("Que_Type")
ACount=ACount+1
JCount=JCount+1
'rs1.move temp
rs1("QueMark")=1
rs1.movenext
end if
next
rs1.close
set rs1=nothing
sql2="select * from question_database where Que_Type=2 and Sub_ID="&v_subjectid&" and DiffRate=2 and QueMark=0 and Knowledge_ID in ("&knowledgearray(0)&","&knowledgearray(1)&","&knowledgearray(2)&","&knowledgearray(3)&","&knowledgearray(4)&","&knowledgearray(5)&","&knowledgearray(6)&","&knowledgearray(7)&")"
set rs2=server.createobject("adodb.recordset")
rs2.open sql2,conn,3,2
for iCount=1 to (v_judgecount*r2/100)
'count1=rs2.recordcount
'temp=fix(count1*rnd)+1
'while temp <= 0 or temp >=count1
'temp=fix(count1*rnd)
'wend
if not rs2.eof then
Ques(ACount)=rs2("QueID")
Questype(ACount)=rs2("Que_Type")
ACount=ACount+1
JCount=JCount+1
'rs2.move temp
rs2("QueMark")=1
rs2.movenext
end if
next
rs2.close
set rs2=nothing
sql3="select * from question_database where Que_Type=2 and Sub_ID="&v_subjectid&" and DiffRate=3 and QueMark=0 and Knowledge_ID in ("&knowledgearray(0)&","&knowledgearray(1)&","&knowledgearray(2)&","&knowledgearray(3)&","&knowledgearray(4)&","&knowledgearray(5)&","&knowledgearray(6)&","&knowledgearray(7)&")"
set rs3=server.createobject("adodb.recordset")
rs3.open sql3,conn,3,2
for iCount=1 to (v_judgecount*r3/100)
'count1=rs3.recordcount
'temp=fix(count1*rnd)+1
' while temp <= 0 or temp >=count1
' temp=fix(count1*rnd)
'wend
if not rs3.eof then
Ques(ACount)=rs3("QueID")
Questype(ACount)=rs3("Que_Type")
ACount=ACount+1
JCount=JCount+1
' rs3.move temp
rs3("QueMark")=1
rs3.movenext
end if
next
rs3.close
set rs3=nothing
sql4="select * from question_database where Que_Type=2 and Sub_ID="&v_subjectid&" and DiffRate=4 and QueMark=0 and Knowledge_ID in ("&knowledgearray(0)&","&knowledgearray(1)&","&knowledgearray(2)&","&knowledgearray(3)&","&knowledgearray(4)&","&knowledgearray(5)&","&knowledgearray(6)&","&knowledgearray(7)&")"
set rs4=server.createobject("adodb.recordset")
rs4.open sql4,conn,3,2
for iCount=1 to (v_judgecount*r4/100)
'count1=rs4.recordcount
' temp=fix(count1*rnd)+1
'while temp <= 0 or temp >=count1
'temp=fix(count1*rnd)
'wend
if not rs4.eof then
Ques(ACount)=rs4("QueID")
Questype(ACount)=rs4("Que_Type")
ACount=ACount+1
JCount=JCount+1
' rs4.move temp
rs4("QueMark")=1
rs4.movenext
end if
next
rs4.close
set rs4=nothing
sql5="select * from question_database where Que_Type=2 and Sub_ID="&v_subjectid&" and DiffRate=5 and QueMark=0 and Knowledge_ID in ("&knowledgearray(0)&","&knowledgearray(1)&","&knowledgearray(2)&","&knowledgearray(3)&","&knowledgearray(4)&","&knowledgearray(5)&","&knowledgearray(6)&","&knowledgearray(7)&")"
set rs5=server.createobject("adodb.recordset")
rs5.open sql5,conn,3,2
for iCount=1 to (v_judgecount*r5/100)
' count1=rs5.recordcount
'temp=fix(count1*rnd)+1
'while temp <= 0 or temp >=count1
'temp=fix(count1*rnd)
' wend
if not rs5.eof then
Ques(ACount)=rs5("QueID")
Questype(ACount)=rs5("Que_Type")
ACount=ACount+1
JCount=JCount+1
'rs5.move temp
rs5("QueMark")=1
rs5.movenext
end if
next
rs5.close
set rs5=nothing
'若产生判断题数目不够,则继续添加
if (v_judgecount-JCount)<>0 then
sql="select * from question_database where Que_Type=2 and Sub_ID="&v_subjectid&" and QueMark=0 and Knowledge_ID in ("&knowledgearray(0)&","&knowledgearray(1)&","&knowledgearray(2)&","&knowledgearray(3)&","&knowledgearray(4)&","&knowledgearray(5)&","&knowledgearray(6)&","&knowledgearray(7)&")"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
for iCount=1 to (v_judgecount-JCount)
'count1=rs.recordcount
'temp=fix(count1*rnd)+1
'while temp <= 0 or temp >=count1
'temp=fix(count1*rnd)
' wend
if not rs.eof then
Ques(ACount)=rs("QueID")
Questype(ACount)=rs("Que_Type")
ACount=ACount+1
JCount=JCount+1
'rs.move temp
rs("QueMark")=1
rs.movenext
end if
next
rs.close
set rs=nothing
end if
'将所有选出的试题号及试卷号和题型存入试卷详细表paper_detail
sql="select * from paper_detail"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
for iCount=0 to (v_singlecount+v_multicount+v_judgecount-1)
rs.addnew
rs("Paper_ID")=v_PaperID
rs("Que_ID")=Ques(iCount)
rs("DQue_Type")=Questype(iCount)
rs.update
rs.movenext
next
sql_message="select * from paper_detail where Paper_ID="&v_PaperID&" and Que_ID is null"
set rs_message=server.createobject("adodb.recordset")
rs_message.open sql_message,conn,3,2
if not rs_message.eof then
response.Write("<script>alert(""题库试题数目不足,请与管理员联系或增加题库中的试题!"")</script>")
end if
rs.close
rs_message.close
set rs=nothing
%>
<%
'将所有试题的QueMark字段重置为0,以方便下次选题
sql="select * from question_database"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
if rs.eof or rs.bof then
response.Write("题库为空,不能生成试卷!")
response.End()
end if
while not (rs.eof or rs.bof)
rs("QueMark")=0
rs.update
rs.movenext
wend
rs.close
set rs=nothing
%>
<p align="center"><b><font face="黑体" size="5" color="#FF0000">网络在线考试 <%=v_papername%></font></b></p>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="100%" height="25"><b><font size="3" color="#000080">一、单项选择题(每题<%=v_singleper%>分,共<%=v_singlecount%>题)</font></b></td>
</tr>
</table>
<%
sql1="select * from paper_detail where DQue_Type=0 and Paper_ID="&v_PaperID&""
set rs1=server.createobject("adodb.recordset")
rs1.open sql1,conn,3,2
while not rs1.eof
tempQue_ID=rs1("Que_ID")
sql="select * from question_database where QueID="&tempQue_ID&""
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
%>
<table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#C0C0C0" width="100%" id="AutoNumber2" cellpadding="0">
<tr>
<td width="90%" bgcolor="#EFEFEF" height="20"> <b><%=sNoumber%>、<%=rs("Question")%></b></td>
<td width="10%" bgcolor="#EFEFEF"><a href="admincreatepaperedit1.asp?vquestionID=<%=rs("QueID")%>&vpaperID=<%=v_PaperID%>">修 改
</a></td>
</tr>
<%
if rs("Option1")<>"" then
%>
<tr>
<td colspan="2"> <input type="radio" name="NO<%=rs("QueID")%>" value="A">A、<%=rs("Option1")%></td>
</tr>
<%
end if
%> <%
if rs("Option2")<>"" then
%>
<tr>
<td colspan="2"> <input type="radio" name="NO<%=rs("QueID")%>" value="B">B、<%=rs("Option2")%></td>
</tr>
<%
end if
%> <%
if rs("Option3")<>"" then
%>
<tr>
<td colspan="2"> <input type="radio" name="NO<%=rs("QueID")%>" value="C">C、<%=rs("Option3")%></td>
</tr>
<%
end if
%> <%
if rs("Option4")<>"" then
%>
<tr>
<td colspan="2"> <input type="radio" name="NO<%=rs("QueID")%>" value="D">D、<%=rs("Option4")%></td>
</tr>
<%
end if
%> <%
if rs("Option5")<>"" then
%>
<tr>
<td colspan="2"> <input type="radio" name="NO<%=rs("QueID")%>" value="E">E、<%=rs("Option5")%></td>
</tr>
<%
end if
%> <%
if rs("Option6")<>"" then
%>
<tr>
<td colspan="2"> <input type="radio" name="NO<%=rs("QueID")%>" value="F">F、<%=rs("Option6")%></td>
</tr>
<%
end if
%>
</table>
<% sNoumber=sNoumber+1
rs1.movenext
'rs.movenext
wend
rs1.close
'rs.close
%>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3">
<tr>
<td width="100%" height="25"><b><font color="#000080" size="3">二、多项选择题(每题<%=v_multiper%>分,共<%=v_multicount%>题。每题至少有2项正确的答案,少选每答对一题得<%=v_multiper/4%>分,多选不得分)</font></b></td>
</tr>
</table>
<%
sql1="select * from paper_detail where DQue_Type=1 and Paper_ID="&v_PaperID&""
set rs1=server.createobject("adodb.recordset")
rs1.open sql1,conn,3,2
while not rs1.eof
tempQue_ID=rs1("Que_ID")
sql="select * from question_database where QueID="&tempQue_ID&""
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
%>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
<tr>
<td width="90%" bgcolor="#EFEFEF" height="20"> <b><%=sNoumber%>、<%=rs("Question")%></b></td>
<td width="10%" bgcolor="#EFEFEF"><a href="admincreatepaperedit1.asp?vquestionID=<%=rs("QueID")%>&vpaperID=<%=v_PaperID%>">修 改
</a></td>
</tr>
<%
if rs("Option1")<>"" then
%>
<tr>
<td colspan="2"> <input type="checkbox" name="NO<%=rs("QueID")%>" value="A">A、<%=rs("Option1")%></td>
</tr>
<%
end if
%> <%
if rs("Option2")<>"" then
%>
<tr>
<td colspan="2"> <input type="checkbox" name="NO<%=rs("QueID")%>" value="B">B、<%=rs("Option2")%></td>
</tr>
<%
end if
%> <%
if rs("Option3")<>"" then
%>
<tr>
<td colspan="2"> <input type="checkbox" name="NO<%=rs("QueID")%>" value="C">C、<%=rs("Option3")%></td>
</tr>
<%
end if
%> <%
if rs("Option4")<>"" then
%>
<tr>
<td colspan="2"> <input type="checkbox" name="NO<%=rs("QueID")%>" value="D">D、<%=rs("Option4")%></td>
</tr>
<%
end if
%> <%
if rs("Option5")<>"" then
%>
<tr>
<td colspan="2"> <input type="checkbox" name="NO<%=rs("QueID")%>" value="E">E、<%=rs("Option5")%></td>
</tr>
<%
end if
%> <%
if rs("Option6")<>"" then
%>
<tr>
<td colspan="2"> <input type="checkbox" name="NO<%=rs("QueID")%>" value="F">F、<%=rs("Option6")%></td>
</tr>
<%
end if
%>
</table>
<% sNoumber=sNoumber+1
rs1.movenext
'rs.movenext
wend
rs1.close
'rs.close
%>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber5">
<tr>
<td width="100%" height="25"><b><font color="#000080" size="3">三、判断题(每题<%=v_judgeper%>分,共<%=v_judgecount%>题)</font></b></td>
</tr>
</table>
<%
sql1="select * from paper_detail where DQue_Type=2 and Paper_ID="&v_PaperID&""
set rs1=server.createobject("adodb.recordset")
rs1.open sql1,conn,3,2
while not rs1.eof
tempQue_ID=rs1("Que_ID")
sql="select * from question_database where QueID="&tempQue_ID&""
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
%>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
<tr>
<td width="90%" bgcolor="#EFEFEF" height="20"> <b><%=sNoumber%>、<%=rs("Question")%></b></td>
<td width="10%" bgcolor="#EFEFEF"><a href="admincreatepaperedit1.asp?vquestionID=<%=rs("QueID")%>&vpaperID=<%=v_PaperID%>">修 改
</a></td>
</tr>
<tr>
<td colspan="2"> <input type="radio" name="NO<%=rs("QueID")%>" value="y">正确</td>
</tr>
<tr>
<td colspan="2"> <input type="radio" name="NO<%=rs("QueID")%>" value="n">不正确</td>
</tr>
</table>
<% sNoumber=sNoumber+1
rs1.movenext
'rs.movenext
wend
rs1.close
'rs.close
set rs=nothing
%>
<table width="970" border="0">
<tr>
<td width="964">
<div align="center">
<input type="submit" name="Submit" value="返回">
</div></td>
</tr>
</table>
</form>
<%conn.close
set conn = nothing%>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?