象大家请教一下,把记录循环储存在数组里,接下来怎么给这个数组分页呢,在线急等!!!
<%@ LANGUAGE = VBScript %><!--#include file="conn2.asp"-->
<%
km=request.QueryString("km")
dim myself
myself="liulan-dan.asp"
'确定显示第几题
'if tmid="" then tmid=1 end if
'tmid=cint(tmid)
'if tmid=0 then tmid=1 end if
'if tmid>=20 then tmid=1 end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网上考试系统 | 系统管理 | 查看编辑题目</title>
<script language="javascript">
function submitit()
{
if (document.all.question.value=="")
{
alert("标题不能为空!");
return false;
}
else
{
return true;
}
}
function delphoto(myform)
{
myform.action="deletephoto.asp";
}
function savephoto1(myform)
{
myform.action="editupfile.asp";
}
function editxiaoti(myform)
{
myform.action="admindatabaseeditread.asp?tmid=<%=tmid%>&readno=1";
}
</script>
<script language="javascript">
<!--
function CheckForm()
{
if (document.form.da.value.length == 0) {
alert("您还没选择!");
document.form.da.focus();
return false;
}
return true;
}
-->
</script>
<link rel="stylesheet" type="text/css" href="css.css">
</head>
<body bgcolor="silver" topmargin=0 leftmargin=0 oncontextmenu="return false" ondragstart="return false" onselectstart="return false">
<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" id="AutoNumber2" width="100%">
<tr>
<td width="100%" bgcolor="#FFFFFF">
<p></td>
</tr>
</table>
<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" id="AutoNumber2" width="100%">
<tr>
<td width="100%" bgcolor="#FFFFFF">
<p>当前位置:系统管理 > 题库管理 > |<a href="liulan-dan.asp?km=<% =km %>">查看所有单选题</a> |<a href="liulan-pan.asp?km=<% =km%>">查看所有判断题</a>|<a href="liulan-duo.asp?km=<% =km%>"> 查看所有多选题</a>|</td>
</tr>
</table>
</p>
<table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#799AE1" width="100%" id="AutoNumber3" height="343">
<tr>
<td align="center" bgcolor="#799AE1" width="121" height="25" bordercolor="#799AE1">
<b><font color="#FFFFFF">类<span lang="en-us"> </span>型</font></b></td>
<td width="515" colspan="3" height="25" bgcolor="#FFFDE8" bordercolor="#799AE1">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber4" width="89">
<tr>
<td width="4"></td>
<td width="85">单选题</td>
</tr>
</table></td>
</tr>
<% Set objRS = Server.CreateObject("ADODB.Recordset")
'-------------------------检索数据-----------------------
strSQL ="select * from tbtk where category =4 and kemu='" & km & "'"
'Sql语句,检索数据库
'创建记录集
objRS.Open strSQL, objConn, 1, 1
'执行检索
Count=objRS.RecordCount
'得到记录总数
Item=3
'显示记录数
'-------------------------检索数据-----------------------
'-------------------------------------------------------------------------------
redim a(Item, 8),t(Count)
'定义2数组,数组a用来储存记录,数组t用来删选记录
'---------------------------------------
'初始数组数值,目的为了插入数据以后和此值做比较
for each j in t
j=0
next
'---------------------------------------
'---------------------------------------
' 随机抽取记录号
Randomize timer '初始化随机数生成器
for j=1 to Item
k=int(rnd*Count+1) '从总数里面随机取一条记录
do while t(k)<>0 '判断是否记录是否已经在数组中
k=int(rnd*Item+1)
loop
t(k)=1 '第k条记录被选中
next
'--------------------------------------
j=1:i=1'定义下标
'--------------------------------------
' 循环选取数据集objRS中的部分记录存放到数组中
Do While Not objRS.Eof
if t(j)=1 then
a(i,1)=objRS("title") '记录id
a(i,2)=objRS("a")
'记录内容
a(i,3)=objRS("b")
a(i,4)=objRS("c")
a(i,5)=objRS("d")
a(i,6)=objRS("e")
a(i,7)=objRS("f")
a(i,8)=objRS("tmid")
i=i+1
end if
j=j+1
objRS.MoveNext
Loop
%>
<%
'----------------------------显示内容--------------------
for i=1 to Item
%><form method="post" action="lulandan1.asp?id=<% =a(i,8)%>">
<tr>
<td align="center" bgcolor="#799AE1" width="121" height="25" bordercolor="#799AE1">
<b><font color="#FFFFFF"> <% =a(i,8)%>标 题</font></b></td>
<td width="515" colspan="3" height="25" bgcolor="#FFFDE8" bordercolor="#799AE1"> <% = a(i,1) %>
</td>
</tr>
<tr>
<td align="center" bgcolor="#799AE1" width="121" height="96" bordercolor="#799AE1">
<b><font color="#FFFFFF">内 容</font></b></td>
<td width="515" colspan="3" height="96" bgcolor="#FFFDE8" bordercolor="#799AE1">
A. <input type="radio" name="da" value="A"> <% =a(i,2)%>
<br>
B. <input type="radio" name="da" value="B"> <% =a(i,3)%>
<br>
C.
<input type="radio" name="da" value="C"> <% =a(i,4)%>
<br>
D.
<input type="radio" name="da" value="D"><% =a(i,5)%>
<br>
<% if a(i,6)<>"" then %> E.
<input type="radio" name="da" value="E"><% =a(i,6)%>
<br>
<% end if %>
<% if a(i,7)<>"" then %> F.
<input type="radio" name="da" value="F"><% =a(i,7)%>
<br>
<% end if %>
</td>
</tr>
<%
Next
%>
<tr>
<td align="center" height="20" bgcolor="#799AE1" width="121" bordercolor="#799AE1">
</td>
<td height="20" width="515" colspan="3" bgcolor="#FFFDE8" bordercolor="#799AE1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="68%">
</td>
<td width="32%"><input type="submit" value="提交" name="B1" class="s02"></td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<table align="center">
<tr><td></td></tr></table>
<%
'释放资源
objRs.Close
set objRs=nothing
objConn.Close
set objConn=nothing
%>