📄 adm_queryquestion.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conndb/conn.asp"-->
<%
getcondition = replace(trim(request("condition")),"'","''")
getkey = replace(trim(request("key")),"'","''")
if(getcondition = "" or getkey = "")then
rssql = "select * from Tab_questions order by que_joindate desc"
else
if(instr(getcondition,"que_lessonid") > 0)then
'instr: 返回某字符串在另一字符串中第一次出现的位置。
rssql = "select * from Tab_questions where que_lessonid in "&_
"(select ID from Tab_Lesson where Name like '%"&getkey&"%') order by que_joindate desc"
else
if(InStr(getcondition,"que_joindate") > 0)Then
rssql = "select * from Tab_questions where convert(varchar(10),"&getcondition&_
",121) like '%"&getkey&"%' order by que_joindate desc"
else
rssql = "select * from Tab_questions where "&getcondition&" like '%"&getkey&_
"%' order by que_joindate desc"
End if
end if
end if
set rs = server.createobject("adodb.recordset") 'conn.Execute(rssql)这个不行,因为好像是游标不对,所以得到的记录总数不对
rs.open rssql,conn,1,3
rs.pagesize = 5
'分页处理
dim rs_total,pageno
if(rs.eof)then
rs_total = 0
else
rs_total = rs.recordcount
end if
getpageno = replace(trim(request("pageno")),"'","")
if(getpageno = "")then
pageno = 1
else
pageno = getpageno
end if
if(not rs.eof)then
rs.absolutepage = pageno
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查询考试试题</title>
<link href="../../style.css" rel="stylesheet">
<script language="javascript" src="../js/js.js"></script>
</head>
<body topmargin="0" leftmargin="0">
<form name="queryquest" method="post" action="adm_QueryQuestion.asp">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr>
<td height="27" colspan=5 align=center><font color="red">查 询 考 试 题 目</font></td>
</tr>
<tr>
<td width="29%" height="26" align=right nowrap>查询条件:</td>
<td width="17%">
<select name="condition" class="wenbenkuang" style="width:150;border:1px solid;">
<option value="que_type">考题类型</option>
<option value="que_lessonid">所属课程</option>
<option value="que_joindate">加入时间</option>
</select>
</td>
<td width="9%" align = right nowrap>关键字:</td>
<td width="24%"><input name="key" type="text" class="txt_grey"></td>
<td width="21%"><input name="submit" type="submit" class="btn_grey" style="border:1px solid;" value="查询"></td>
</tr>
</table>
</form>
<form name="delquestion" method="post">
<table width="100%" border="1" cellspacing="0" cellpadding="0" align="center"
bordercolor="#FFFFFF" bordercolordark="#006699" bordercolorlight="#FFFFFF">
<tr>
<td width="13%" height="27" align="center" nowrap>选 项</td>
<td width="20%" height="27" align="center" nowrap>考试题目</td>
<td width="22%" height="27" align="center" nowrap>考试类型</td>
<td width="15%" height="27" align="center" nowrap>加入时间</td>
<td width="23%" height="27" align="center" nowrap>所属课程</td>
<td width="7%" align="center" nowrap>修改</td>
</tr>
<%
if(rs.eof)then
%>
<tr><td height="27" colspan=7 align=center nowrap><font color="red">没有符合条件的记录!</font></td>
</tr>
<%
else
rs_repeat = 0
while((rs_repeat < rs.pagesize) and (not rs.eof))
%>
<tr>
<td height="27" align=center nowrap>
<input type="checkbox" name="ChkBox" value="<%=server.htmlencode(rs("id"))%>"> </td>
<td height="27" align=center nowrap><%=server.htmlencode(rs("que_subject"))%></td>
<td height="27" align=center nowrap><%=server.htmlencode(rs("que_type"))%></td>
<td height="27" align=center nowrap><%=rs("que_joindate")%></td>
<td height="27" align=center nowrap>
<%
sql_1 = "select * from Tab_Lesson where ID = "&rs("que_lessonid")
set rs_1 = conn.Execute(sql_1)
if(not rs_1.eof)then
response.write(server.htmlencode(rs_1("Name")))
end if
rs_1.close
set rs_1 = nothing
%> </td>
<td height="27" align=center nowrap>[<a href="adm_UpdateQuestion.asp?id=<%=rs("id")%>&proid=<%=rs("que_professionid")%>&lesid=<%=rs("que_lessonid")%>" target="mainr">修改</a>]</td>
</tr>
<%
rs_repeat = rs_repeat + 1
rs.movenext
wend
'rs.movefirst
%>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr>
<td colspan=5> </td>
</tr>
<tr>
<td width="3%" height="26" align=center nowrap><input type="checkbox" name="checkbox" onClick="CheckAll(this.form.ChkBox,this.form.checkbox)"></td>
<td width="7%" align=center nowrap>[全选/反选]</td>
<td width="32%" nowrap>[<a style="color:red;cursor:hand;" onclick="Check(delquestion)">删除</a>]
<%'这里用这几个隐藏域是为了把显示这个页面所需的参数传递到删除页面,然后再由删除页面传回本页面。%>
<input type="hidden" name="condition" value="<%=getcondition%>">
<input type="hidden" name="key" value="<%=getkey%>">
<input type="hidden" name="pageno" value="<%=getpageno%>">
</td>
<td width="7%"></td>
<td width="51%">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr>
<td align=right nowrap>
[<%=pageno%>/<%=rs.pagecount%>]| [共<font color=red><%=rs_total%></font>条]
[
<%
if(pageno <> 1)then
%>
<a href="adm_QueryQuestion.asp?condition=<%=getcondition%>&key=<%=getkey%>">第一页</a>
<%
end if
%>
<%
if(pageno <> 1)then
%>
<a href="adm_QueryQuestion.asp?condition=<%=getcondition%>&key=<%=getkey%>&pageno=<%=(pageno-1)%>">上一页</a>
<%
end if
%>
<%
'response.write(pageno&" ")
'response.write(cstr(rs.pagecount)&" ")
'response.write(instr(pageno,cstr(rs.pagecount)) = 0)
'这里要判断一下pageno和rs.pagecount的值相等的情况,如果不判断,当它俩的值相等时,pageno<>cstr(rs.pagecount)还是true
if(instr(pageno,cstr(rs.pagecount)) = 0)then
%>
<a href="adm_QueryQuestion.asp?condition=<%=getcondition%>&key=<%=getkey%>&pageno=<%=(pageno+1)%>">下一页</a>
<%
end if
%>
<%
if(instr(pageno,cstr(rs.pagecount)) = 0)then
%>
<a href="adm_QueryQuestion.asp?condition=<%=getcondition%>&key=<%=getkey%>&pageno=<%=rs.pagecount%>">最后一页</a>
<%
end if
rs.close
set rs = nothing
%>]</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<%
end if
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -