<!--#include file="conn.asp"--> <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <mce:script type="text/javascript"><!-- function realDel(id){ if(confirm("真得要删除吗?")){ window.location = "delSingleAns.asp?id="+id; } } function pagefun(page){ } // --></mce:script> <link href="images/form.css" mce_href="images/form.css" rel="stylesheet" type="text/css" /> <link href="images/table.css" mce_href="images/table.css" rel="stylesheet" type="text/css" /> </head> <body> <form action="editSingleAns.asp" id="thisform" method="post"> <input name="currentPage" type="hidden" value="" /> <fieldset> <p><label for="name" accesskey="9">试题名称:</label> <% if request.form("sname")<>"" then snameTemp = request.form("sname") else snameTemp = request.queryString("sname") end if sname = snameTemp %> <input name="sname" type="text" size="30" value="<%=sname%>" /> <label for="name" accesskey="9">课本名称:</label> <select name="bookid" id="bookid"> <option selected value="-1">--请选择--</option> <% set rs=server.CreateObject("adodb.recordset") sql1="select * from book" rs.open sql1,conn,1,1 if not (rs.eof and rs.bof) then do while not rs.eof %> <option value=<%=rs("id")%> <%if cint(request.querystring("bid"))=cint(rs("id")) or cint(request.form("bookid"))=cint(rs("id")) then response.write(" selected ") end if%>><%=rs("name")%></option> <% rs.movenext loop end if %> </select> <input name="hiddenPage" type="hidden" value="" /> <input name="Input" type="submit" value="搜索" /></p> </fieldset> <% %> <table width="100%" id="mytable" > <tr> <th width="10%" scope="col">编号</th> <th width="10%" scope="col">名称</th> <th width="20%" scope="col">所属课程</th> <th width="20%" scope="col">入库时间</th> <th width="20%" scope="col">更新时间</th> <th width="10%" scope="col">修改</th> <th width="10%" scope="col">删除</th> </tr> <% set rs=server.CreateObject("adodb.recordset") s = request.Form("s") 'sname = request.Form("sname") if request.Form("bookid")<>"" then bid = request.Form("bookid") else bid = request.querystring("bid") end if sql = "select s.*,b.name from singleAns s,book b where s.bookId=b.id" if sname<>"" then sql=sql&" and s.title like '%"&sname&"%'" end if if bid<>"" and bid<>"-1" then sql=sql&" and b.id="&bid end if sql=sql&" order by s.updateTime desc" Set rs1=Server.CreateObject("ADODB.RecordSet") totalNumsql = "select count(*) as c from ("&sql&")" rs1.Open totalNumsql,conn,1,1 totalCount = rs1("c") '总数据 pageSize = 5 if request.querystring("page")="" then currentPage = 1 '当前页 else currentPage = request.querystring("page") end if If totalCount mod pageSize =0 Then totalPage = totalCount / pageSize 'totalPage = totalCount/pageSize '总页数 else totalPage = int(totalCount / pageSize)+1 end if 'select * from (select top 9 * from (select s.*,b.name from singleAns s,book b where s.bookId=b.id order by s.updateTime desc)) where 'id not in (select top 6 id from (select s.*,b.name from singleAns s,book b where s.bookId=b.id order by s.updateTime desc)) if pageSize*(currentPage-1) <> 0 then sql = "select * from (select top "&pageSize*currentPage&" * from ("&sql&")) WHERE id NOT IN (select top "&pageSize*(currentPage-1)&" id from ("&sql&"))" end if if pageSize*(currentPage-1) = 0 then sql = "select top "&pageSize*currentPage&" * from ("&sql&")" end if rs.open sql,conn,1,1 if not (rs.eof and rs.bof) then do while not rs.eof %> <tr> <td><%=rs("id")%></td> <td><input name="bookName" type="text" id="bookName" value="<%=rs("title")%>" /></td> <td><%=rs("name")%></td> <td><%=rs("insTime")%></td> <td><%=rs("updateTime")%></td> <td><a href="#" mce_href="#">修改</a></td> <td><a href="#" mce_href="#" onclick="return realDel(<%=rs("id")%>);">删除</a></td> </tr> <% rs.movenext loop end if %> </table> <table width="100%" border="1" align="center"> <tr> <th scope="col">共<%=totalCount%>条数据 <%=pageSize%>条/页 当前<%=currentPage%>页 共<%=totalPage%>页 <% tempfirst = "editSingleAns.asp?page=1" if sname<>"" then tempfirst = tempfirst&"&sname="&sname end if if bid<>"" then tempfirst = tempfirst&"&bid="&bid end if %> <a href="<%=tempfirst%" mce_href="<%=tempfirst%">>首页</a> <% tempnext = "editSingleAns.asp?page="¤tPage-1 if sname<>"" then tempnext = tempnext&"&sname="&sname end if if bid<>"" then tempnext = tempnext&"&bid="&bid end if if currentPage = 1 then response.write "上页" else response.write "<a href="&tempnext&" mce_href="&tempnext&">上页</a>" end if response.write " " %> <% tempstr = "editSingleAns.asp?page="¤tPage+1 if sname<>"" then tempstr = tempstr&"&sname="&sname end if if bid<>"" then tempstr = tempstr&"&bid="&bid end if %> <% if int(currentPage)=int(totalPage) then response.write "下页" else response.write "<a href=""&tempstr&"" mce_href=""&tempstr&"">下页</a>" end if %> <% templast = "editSingleAns.asp?page="&totalPage if sname<>"" then templast = templast&"&sname="&sname end if if bid<>"" then templast= templast&"&bid="&bid end if %> <a href="<%=templast%>">尾页</a> 跳转到<select name="page" id="page" onchange="window.location.href=this.value;"> <% for i=1 to int(totalPage) temp1 = "editSingleAns.asp?page="&i if sname<>"" then temp1 = temp1&"&sname="&sname end if if bid<>"" then temp1 = temp1&"&bid="&bid end if response.write "<option value="&temp1&">"&i&"</option>" next %> </select> 页 </th> </tr> </table> </form> </body> </html>