标题:批量删除代码分页显示已搞好!
取消只看楼主
ningzhonghui
Rank: 2
等 级:论坛游民
帖 子:74
专家分:13
注 册:2010-11-19
结帖率:84.62%
已结贴  问题点数:5 回复次数:1 
批量删除代码分页显示已搞好!
兄弟以下是你帮我改好的代码,但我现在就是加了条件就不能下一页拉为什么拉
sql="select * from upfile"
改成有条件的拉sql="select * from upfile where username='"&user&"'"

程序代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.>
<html xmlns="http://www.>
<head>
<title>1323</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="inc/admin.css" type="text/css">
<SCRIPT language=JavaScript type=text/JavaScript>
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked;
   }
  }

</SCRIPT>

</head>

<body>
<div>
<form name="del" action="del_skins.asp" method="post">
<table width="70%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#3399CC">
  <tr>
    <td width="5%" height="25" align="center"><font color="red">ID号</font></td>
    <td width="10%" height="25" align="center"><font color="red">用户</font></td>
    <td width="10%" height="25" align="center"><font color="red">皮肤名称</font></td>
    <td width="10%" height="25" align="center"><font color="red">文件名</font></td>
    <td width="10%" height="25" align="center"><font color="red">皮肤路径</font></td>
    <td width="5%" height="25" align="center">&nbsp;</td>
    <td width="5%" align="center"><font color="red">删除</font></td>
  </tr>
  <%
set rs=server.createobject("adodb.recordset")
sql="select * from upfile"
rs.open sql,conn,1,3
Dim TotalPage,CurrentPage,TotalCount
rs.PageSize=5 '每页数量
TotalPage=rs.Pagecount '总页数
TotalCount=rs.RecordCount '总数量
CurrentPage=request("page") '当前页
if not isNumeric(CurrentPage) or CurrentPage="" then
CurrentPage=1
else
CurrentPage=Clng(CurrentPage)
end if
if CurrentPage>TotalPage then
CurrentPage=TotalPage
end if
rs.AbsolutePage=CurrentPage
for i=1 to rs.PageSize
if rs.eof then Exit for  %>
<tr>
<td align="center"><input align="center" name="-" type="text" class="input1" id="-" value="<%=rs("id")%>" size="10" maxlength="100" disabled></td>
<td align="center"><input align="center" name="username" type="text" class="input1" id="username" value="<%=rs("username")%>" size="15" maxlength="100"></td>
<td align="center"><input name="fileremark" type="text" class="input1" id="fileremark" value="<%=rs("fileremark")%>" size="15" maxlength="100"></td>
<td align="center"><input name="filename" type="text" class="input1" id="filename" value="<%=rs("filename")%>" size="15" maxlength="100"></td>
<td align="center"><input name="fileurl" type="text" class="input1" id="look" value="<%=rs("fileurl")%>" size="15" maxlength="100"></td>

    <td height="25" align="center"><label>
  <input type="checkbox" name="id" value="<%=rs("id")%>">
    
    </label></td>
    <td align="center">删除</td>
  </tr>
    <%
rs.movenext
Next  %>

  <tr>
    <td height="25" align="center">&nbsp;</td>
    <td height="25" align="center"><label>
<input name="chkall" type="checkbox" id="chkall" value="select" onclick=CheckAll(this.form)>
    
    </label></td>
    <td align="center">选中全部</td>
  </tr>
  <tr>
    <td height="25" colspan="3" align="center"><label>
      <input type="submit" name="Submit" value="删除所选" onclick="{if(confirm('确定要删除皮肤及文件吗?')){return true;}return false;}" />
     &nbsp; &nbsp;&nbsp;
      <input type="reset" name="Submit2" value="重置" />
    </label></td>
    </tr>
</table>
</form>
<div><% Response.Write(""&TotalCount&"")
if CurrentPage=1 then
Response.Write(" 首页 上一页 ")
else
Response.Write(" <a href=""?page=1"">首页</a> ")
Response.Write(" <a href=""?page="&CurrentPage-1&""">上一页</a> ")
end if
if CurrentPage=TotalPage then
Response.Write(" 下一页 尾页 ")
else
Response.Write(" <a href=""?page="&CurrentPage+1&""">下一页</a> ")
Response.Write(" <a href=""?page="&TotalPage&""">尾页</a> ")
end if
Response.Write(CurrentPage&"/"&TotalPage)
%></div>
</body>
</html>



[ 本帖最后由 ningzhonghui 于 2010-12-28 09:39 编辑 ]
搜索更多相关主题的帖子: 兄弟 
2010-12-27 21:56
ningzhonghui
Rank: 2
等 级:论坛游民
帖 子:74
专家分:13
注 册:2010-11-19
得分:0 
回复 2楼 hams
条件条数绝对条数分页,过滤条件也没事的拉,去掉过滤条件一切正常!上网也查了资料好你像这种方式分页的就不能适合有过滤条件的!
呵呵经过细心检查问题出于这里
Response.Write(" <a href=""?page=1"">首页</a> ")
Response.Write(" <a href=""?page="&CurrentPage-1&""">上一页</a> ")
end if
if CurrentPage=TotalPage then
Response.Write(" 下一页 尾页 ")
else
Response.Write(" <a href=""?page="&CurrentPage+1&""">下一页</a> ")
Response.Write(" <a href=""?page="&TotalPage&""">尾页</a> ")
也相应过滤条件参数加上如
Response.Write(" <a href=""?user=aa&page=1"">首页</a> ")


[ 本帖最后由 ningzhonghui 于 2010-12-28 09:37 编辑 ]
2010-12-28 09:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-330065-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.352426 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved