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

📄 autodo.asp

📁 本系统用来开发网络开发系统的实现
💻 ASP
字号:
<!--#include file="adovbs.inc" -->
<!--#include file="admin_conn.asp"-->
<SCRIPT src="calendar.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function load()
{ 
	document.shijuanadd.BeginInputDate.value=getlastweekDate();
    
}
function check() {
		if (document.shijuanadd.shijuanshuoming.value=="" )
		{
			window.alert("试卷描述是必添字段,请输入试卷描述编号!");
			document.shijuanadd.shijuanshuoming.focus();
			return false;
		}
		if(document.shijuanadd.shijuanstr.value=="")
		{
		window.alert("没有可以输入试卷编号!请重新选题");
			document.shijuanadd.shijuanshuoming.focus();
		return false;
		}
		
	}
//-->
</script>
<%'实现打开数据库和显示指定的记录列表
	
'///////////////////////////////////////////////////////////////////////////////////////
	kechengjihe=Request.Form("kechengjihe")
	text2=Request.Form("text2")
	subject_ids=Request.Form("subject_ids")
	 'set str=session("str")
	 dim str1
	 dim str_miaoshu
	str1=array(1,3,5,2,7,9,11,13)
	dim tizongliang		'要求生成的题目数量
	dim shijizhi		'实际的生成题目数量
	dim shijuan(90)
	dim shijuantihao
	dim nianji
	nianji=session("nianji")
	''Response.write nianji
	for i=0 to 89
	shijuan(i)=0
	
	next
	dim temp_i
	temp_i=0
	dim z
		z=0

	'set conn=server.CreateObject("adodb.connection")
	set rs1=server.CreateObject("adodb.recordset")
	set rs_ti=server.CreateObject("adodb.recordset")

	'conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\donny\9-23-lab-jia\s223bsh01.mdb;Persist Security Info=False"
	'conn.Open  "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("s223bsh03.mdb") &  ";Persist Security Info=False"
	'conn.Open application("constring")
	
	rs1.Open "select * from test_questions_store",conn,adOpenStatic

	'pageth=cint(pageth)
	'if pageth>rs1.PageCount then pageth=rs1.PageCount 
	
	'rs1.AbsolutePage=pageth
	subject_ids=split( subject_ids , ", " )
	
	text2=split( text2 , ", " )
	
	for i=0 to UBound(text2, 1)
	err.Clear 
	on error resume next
	
	
	tizongliang=cint(text2(i))+tizongliang
	if  (err.number <>0) then 
	
	 %>
		<script  language="javascript">
			<!--
				window.alert("课程数量必须是数字,请重新输入!");//另外打开一个窗口
				//window.open("9-22.asp");
			//document.closed
			window.location="autodomain.asp";
			-->
		</script>
		<%
		'Response.Redirect "9-22.asp"
		Response.End 
	end if
	
	next
	kechengjihe=split( kechengjihe , ", " )
	'Response.write "UUUUUUUUUUUUUUUUUU'U"
	'Response.write UBound(subject_ids, 1)
	'Response.write "UUUUUUUUUUUUUUUUUUU<br>"
		'for z=0 to UBound(subject_ids, 1)
			'Response.write "<br>第" & z & "次的循环调用autodo函数" & "<br>"
			'for h=0 to UBound(kechengjihe, 1)
			'if subject_ids(z)=kechengjihe(h) then 
				
			'	Response.write (subject_ids(z) & "-" & text2(h))
			'	call autodo(subject_ids(z),text2(h))
				
			'end if
			'next
			'Response.write "<hr>"
		'next
		'Response.write  "< form > "
		Response.write "<table align=center border=1 cellpadding=0 width=80% cellspacing=0  >"
		Response.write " <tr> <td colspan='9' > 试卷统计: </td></tr> "
		'Response.write
	for z=0 to UBound(text2, 1)
		if text2(z)<>"0" then 
		str_maioshu=""
		call autodo(kechengjihe(z),text2(z)) 
		Response.write " <tr> <td colspan='9' > "  & str_miaoshu & " </td> </tr> "
		'Response.write (str_miaoshu)
		'Response.write "<hr>"
		end if
		
		
		next
	'Response.write "<hr>"
	'Response.write "提出的课程号:"
	'Response.Write Request.Form("subject_ids")
	'Response.write "<hr>"
	str1=split( shijuantihao , "/" )
	shijizhi=UBound(str1, 1)+1
	Response.write " <tr> <td colspan='9' > 试卷题目列表:"  & shijuantihao & " </td> </tr> "
	Response.write " <tr><td colspan='9'>要求的出题数是" & tizongliang & ",    共有" & shijizhi & "道题目符合要求</td></tr>"
	if shijuantihao<>"" then
	shijuantihao=shijuantihao & "/"
	end if
	Response.write "</table>"
	'Response.write session("nianji")

	
	'//////////////自动生成试卷的主算法///////////////////////////
	function autodo(kehao,num)
		'response.write(kehao & "@@@@@@@@@")
		dim hao
		dim jilu
		dim shuliang
		dim yaoqiu
		shuliang=cint(num)
		yaoqiu=cint(num)
		'rs_ti.Open "select * from 题库 where 题目详解 = 'HTML'"  , conn
		rs_ti.Open "select * from test_questions_store where 课程编号 = " & cint(kehao) ,conn,adOpenStatic
		'response.write("课程号是:" & cint(kehao) )
		'response.write("题目数量是:" & shuliang )
		'response.write "<br>"
		'rs_ti.Open "select * from 题库 where 课程编号=" & kehao "'",conn,adOpenStatic
		if (rs_ti.RecordCount=0) then 
		shuliang=0
		str_miaoshu="出题科目:数据库中没有这门科目的题目!"
		
		rs_ti.Close
		exit function
		end if
		if( shuliang>rs_ti.RecordCount) then 
%>
<script language="javascript">
<!--
alert("题目数量过多,超出题库的题目数");
-->
</script>
<%
		'Response.Redirect "9-22.asp"
		'exit function
		shuliang=rs_ti.RecordCount
		end if
		'Response.write "<br>"
		'response.write("!!!!!!!!!根据课程好查出的记录个数是:" & rs_ti.RecordCount & "!!!!!" )
		Response.write "<br>"
		'response.write ("酸法生成的随几数,不朝过记录的个数")
		str_miaoshu="出题科目:" & rs_ti("题目详解") & ",         要求出题:" & yaoqiu & ",           实际出题:" & shuliang
		for i=0 to  shuliang-1
			
			jilu=2
			Randomize 
			hao=Int((rs_ti.RecordCount- 1 + 1) * Rnd + 1)
			for j=0 to i
			if shijuan(j)=hao then 
				jilu=1
			end if
		next
		if jilu<>1 then
		shijuan(i)=hao
		'response.write (hao & "_________")
		else
		i=i-1
		end if
		next
		autodo=1
		temp_i=i
		for i=0 to temp_i-1
		rs_ti.MoveFirst
		rs_ti.move (shijuan(i)-1)
		'‘Response.Write "<br>选出的题号是::____"
	   'Response.Write rs_ti("id")
		if shijuantihao <>"" then
		shijuantihao=shijuantihao & "/" & rs_ti("id")
		else
		shijuantihao=rs_ti("id")
		end if
		next		
		rs_ti.Close
	end function
	
	
	
'/////////////////////////////生成试卷算法结素////////////////////////
function add(liebiao,miaoshu,shijian,tiliang,xueqi )




end function 
  'Response.Redirect "subjects_admin.asp?pageth=" & pageth
  
%>
	
<form action="testlist.asp" method="post" name=shijuanadd onSubmit="return check()">
<table align=center border=1 cellpadding=0 width=80% cellspacing=0  >
<tr><td colspan="9">要求的出题数是<%=tizongliang%>.  共有<%=shijizhi%>道题目符合要求</td></tr>
<tr>
<td colspan="9">
<input type="hidden" name="add" value=add>
<input type="hidden" name="xueqi" value=<%=nianji%> >
<input type="hidden" name="tiliang" value=<%=shijizhi%>>
<input type="hidden" name="shijuanstr" value=<%=shijuantihao%>>
试卷说明:
<input  name="shijuanshuoming" value="">

       指定考试时间:
<INPUT name=BeginInputDate type=text size=10
				onclick="fPopCalendar(BeginInputDate,BeginInputDate);return false" readOnly>
<input type=submit id=submit2 name=submit2  value="提交生成的试卷">
<input type=reset value="重新生成试卷" id=reset1 name=reset1 onclick="back()">

</td>
</tr>
<%
	

	
%>
<tr align=center>
	<td>试题编号</td>
	<td>试题内容</td>
	<td>试题答案A</td>
	<td>试题答案B</td>
	<td>试题答案C</td>
	<td>试题答案D</td>
	<td>正确答案</td>
	<td>课程详解</td>
	<td>所属科目编号</td>
</tr>
	
<% 
for i=0 to UBound(str1, 1)
rs1.MoveFirst
rs1.Find "id='" & str1(i) & "'"
'recordStuInfo.Find "StudentID='" & Me.Text1 & "'"	
%> 
	
	<tr align=center>

<%
	response.Write ("<td>" & Server.HTMLEncode(rs1(0)) & "</td>" )
	response.Write ("<td>" & Server.HTMLEncode(rs1(1)) & "</td>" )
	response.Write ("<td>" & Server.HTMLEncode(rs1(2)) & "</td>" )
	response.Write ("<td>" & Server.HTMLEncode(rs1(3)) & "</td>" )
	response.Write ("<td>" & Server.HTMLEncode(rs1(4)) & "</td>" )
	response.Write ("<td>" & Server.HTMLEncode(rs1(5)) & "</td>" )
	response.Write ("<td>" & Server.HTMLEncode(rs1(6)) & "</td>" )
	response.Write ("<td>" & Server.HTMLEncode(rs1(7)) & "</td>" )
	response.Write ("<td>" & Server.HTMLEncode(rs1(8)) & "</td>" )
	
	
	%>
	</td>
	
	
	
	</tr>
<%
	if rs1.EOF then exit for  '避免存在半页时循环出现问题;
	next
	
	pagepre=pageth-1
	pagenext=pageth+1
	if pagepre<1 then pagepre=1
	if pagenext>rs1.PageCount then pagenext=rs1.PageCount 
	rs1.Close	
	conn.Close
%>


</table>
</form>
<script language="javascript">
///////////////////////////////////////////////////////////////////////////////////////////////////////
	
	function select_change() 
	{
	document.form1.submit()
	}
	function back()
	{
	window.location ="autodomain.asp"
	
	}
	load();
		
</script>

⌨️ 快捷键说明

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