|
#2
2010-05-03 17:44
|
下面是与删除板块衔接的板块
problemadmin.asp
<%@ Language="vbscript"%>
<%set conn=server.createobject("adodb.connection")
str="driver={sql server};database=student;server=(local);uid=sa;pwd=123"
conn.open str
strpage=request.form("page")
strsql="select * from problem order by id desc"
set rs=server.createobject("ADODB.Recordset")
rs.open strsql,conn,1,3
%><style type="text/css">
<!--
body {
background-image: url(%E6%96%B0%E5%BB%BA%E6%96%87%E4%BB%B6%E5%A4%B9/GREEN.JPG);
}
.STYLE1 {font-size: 18px}
.STYLE18 {font-size: 24px}
.STYLE19 {color: #336600; font-weight: bold;}
.STYLE20 {color: #FF0000}
.STYLE21 {font-size: 24px; font-weight: bold; }
-->
</style>
<form action="problem_item.asp" method="post" name="form1" class="STYLE1">
<table border=0 cellspacing="1" align=center>
<%const maxperpage=10
rs.movefirst
rs.pagesize=maxperpage
if trim(request("page"))<>""and isnumeric(request("page"))then
currentpage=clng(request("page"))
if currentpage<1 then
currentpage=1
else if currentpage>rs.pagecount then
currentpage=rs.pagecount
end if
end if
else
currentpage=1
end if
if rs.eof then
response.write"<p align='center'>占无记录</p>"
else
totalput=rs.recordcount
if currentpage=1 then
showpages
showcontent
else
if(currentpage-1)*maxperpage<totalput then
rs.move(currentpage-1)*maxperpage
dim bookmark
bookmark=rs.bookmark
showpages
showcontent
else
currentpage=1
showcontent
end if
end if
rs.close
end if
set rs=nothing
set conn=nothing%>
<%sub showcontent%>
<p>
<tr class="tr3">
<td width="50" align="center">标记</td>
<td width="100" align="center">学号 </td>
<td width="100" align="center"> 问题类型</td>
<td width="300" align="left">标题</td>
<td width="300" align="center">提问时间</td>
<td width="300" align="left">回答标志</td>
</tr>
<%
dim i
i=0
do while not(rs.eof or err)
%>
<tr class="<%=classtype%>">
<%'--checkbox是用做删除的标记%>
<td width="10%" align="center"><input type="checkbox" name="id"
value="<%=rs("id")%>"></td>
<td width="15%" align="center"><%=rs("sno")%></td>
<td width="20%"><%= rs("leixing")%></td>
<td width="15%"><a href="problem_item.asp?id=<%=rs("id")%>&page=<%=strpage%>"><%=rs("title")%></a></td>
<td width="25%" ><%response.write rs("times")%></td>
<td width="15%">
<%
if rs("flag_answer")=true then
response.write"已解答"
else
response.write"未解答"
end if
%>
<tr><td colspan="4">
<%
i=i+1
if i>=maxperpage then exit do
rs.movenext
loop
%></table>
<%end sub%>
<%sub showpages()%>
<p align="left">
<%
dim n,k
if(totalput mod maxperpage)=0then
n=totalput\maxperpage
else
n=totalput\maxperpage+1
end if%>共计有<%=rs.recordcount%>条记录 <%
k=currentpage
if k=1 then
response.write"[上一页]"
else
response.write"[<b>"+"<a href='problemadmin.asp?page=1'>首页</a></b>]"
response.write"[<b>"+"<a href='problemadmin.asp?page="+cstr(k-1)+"'>上一页</a></b>]"
end if
if k=n then
response.write"[下一页][尾页]"
else
response.write"[<b>"+"<a href='problemadmin.asp?page="+cstr(k+1)+"'>下一页</a></b>]"
response.write"[<b>"+"<a href='problemadmin.asp?page="+cstr(n)+"'>尾页</a></b>]"
end if
end sub%>
<p>
<input type="hidden"name="page"value="<%=strpage%>" />
<input type="button" id="btndel" value="删除" name="btndel">
</p>
</form>
</td>
<span class="STYLE1">
</tr>
</table>
<script language="vbscript">
</script>
</span>
<script language="vbscript">sub btndel_onclick
msg="是否确定删除?"
if msgbox(msg,1,"网络学堂")=1 then
form1.action="problemadmin.asp"
form1.submit
end if
end sub
</script>
[ 本帖最后由 ASP编程菜鸟 于 2010-5-3 17:47 编辑 ]