| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 786 人关注过本帖
标题:删除最后页最后一条记录问题
只看楼主 加入收藏
hjtdlx
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-5-16
收藏
 问题点数:0 回复次数:1 
删除最后页最后一条记录问题

希望高手帮我看一下问题出在哪里,我选择删除的时候仍然会跳转默认分类

<!--#include file="conn.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新闻添加</title>
<link href="/css/site_font.css" rel="stylesheet" type="text/css">
<link href="../css/xxl.css" rel="stylesheet" type="text/css">
</head>
<%
if request("act")= "del" then
news_sort=request("sort")
session("news_sort")=news_sort
id=request("id")
page=request("page")
total_recordcount=request("total_recordcount")
lastpage=total_recordcount\4+1
jg=cstr((page-1)*4+1)=total_recordcount
if jg=true then
conn.execute("delete * from news where id="&id)
page_count=page-1
response.Write "<script language=javascript>alert('删除成功!');window.location.href='news_manger.asp?page="&page_count&"'</script>"
else
conn.execute("delete * from news where id="&id)
page_count=page
response.Write "<script language=javascript>alert('删除成功!');window.location.href='news_manger.asp?&sort="&session("news_sort")&"&page="&page_count&"'</script>"
page_count=page
end if

end if
%>
<%
news_sort=request("sort")
select case news_sort
case "新闻动态"
sql="select * from news where news_sort='新闻动态'"
link="../news.asp?news_sort=新闻动态&"
case "行业动态"
sql="select * from news where news_sort='行业动态'"
link="../news.asp?news_sort=行业动态&"
case "公司新闻"
sql="select * from news where news_sort='公司新闻'"
link="../news.asp?news_sort=公司新闻&"
case "媒体报道"
sql="select * from news where news_sort='媒体报道'"
link="../news.asp?news_sort=媒体报道&"
case else
sql="select * from news where news_sort='新闻动态'"
link="../news.asp?news_sort=新闻动态&"
end select
%>
<body>
<%
set rs=server.CreateObject("adodb.recordset")
url="news_manger.asp?sort="&news_sort
rs.open sql,conn,1,3
if rs.eof then
response.write "请添加"&news_sort
else
url1="news_manger.asp?sort="&news_sort&"&page="&page_count
%>
<form action="<%=url1%>" method="get" name="xxl" class="site_font">
<select name="sort" onChange="xxl.submit()" id="sort">
<option value="新闻动态" <%if instr(rs("news_sort"),"新闻动态")>0 then%> selected <%end if%>>新闻动态</option>
<option value="行业动态" <%if instr(rs("news_sort"),"行业动态")>0 then%> selected <%end if%>>行业动态</option>
<option value="公司新闻" <%if instr(rs("news_sort"),"公司新闻")>0 then%> selected <%end if%>>公司新闻</option>
<option value="媒体报道" <%if instr(rs("news_sort"),"媒体报道")>0 then%> selected <%end if%>>媒体报道</option>
</select>

<%
if not isempty(request("page")) then
pagecount=cint(request("page"))
else
pagecount=1
end if
total_recordcount=rs.recordcount
page_count=pagecount
rs.pagesize=4
rs.AbsolutePage=pagecount
%>
<table width="800" border="0" align="center" class="site_font">
<tr>
<td width="19" scope="col">ID</td>
<td width="623" align="center" scope="col">新闻标题</td>
<td width="144" align="center" scope="col">添加时间</td>
<td width="144" align="center" scope="col">修改</td>
<td width="144" align="center" scope="col">删除</td>
</tr>
</table>
<table width="800" border="0" align="center" class="site_font">
<%
n=1
do while not rs.eof%>
<tr>
<td width="19" scope="col"><%=n%></td>
<td width="623" align="center" scope="col"><a href="<%=link%>id=<%=rs("id")%>"><%=rs("title")%></a></td>
<td width="144" align="center" scope="col"><%=rs("add_date")%></td>
<td width="144" align="center" scope="col"><a href="news_edit.asp?id=<%=rs("id")%>" target="admin_right">修改</a></td>
<td width="144" align="center" scope="col"><a href="news_manger.asp?act=del&id=<%=rs("id")%>&page=<%=page_count%>&sort=<%=rs("news_sort")%>&total_recordcount=<%=total_recordcount%>" target="admin_right">删除</a></td>
</tr>
<%
n=n+1
rs.movenext
if n>rs.pagesize then exit do
loop
end if
%>
</table>

</form>
<%
news_sort=request("sort")
response.write news_sort
response.write page_count
response.end%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<form action="<%=url%>" method="get">
<tr>
<td height="22">
<div align="center">页次: <b><font color=red><%=page_count%></font>/<%=rs.pagecount%></b>
<% if pagecount=1 and rs.pagecount<>pagecount and rs.pagecount<>0 then%>
<a href="<%=url%>&page=<%=cstr(pagecount+1)%>">
下一页</a>
<% end if %>
<% if rs.pagecount>1 and rs.pagecount=page_count then %>
<a href="<%=url%>&page=<%=cstr(pagecount-1)%>">
上一页</a>
<%end if%>
<% if pagecount<>1 and rs.pagecount<>pagecount then%>
<a href="<%=url%>&page=<%=cstr(pagecount-1)%>">
上一页</a> <a href="<%=url%>&page=<%=cstr(pagecount+1)%>">
下一页</a>
<% end if%>
&nbsp; 直接到第
<select name="page">
<%for i=1 to rs.pagecount%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>

<input type="submit" name="go" value="Go">
<input type="hidden" name="product_name" value="<%=product_name%>">
<input type="hidden" name="product_sort" value="<%=product_sort%>">
</div>
</td>
</tr>
</form>

</table>
</body>
</html>

搜索更多相关主题的帖子: css sort rel request 
2007-06-18 15:45
恒天
Rank: 1
等 级:新手上路
威 望:2
帖 子:165
专家分:0
注 册:2007-6-1
收藏
得分:0 
conn.execute("delete * from news where id="&id)
改成conn.execute("delete from news where id="&id)
2007-06-18 19:04
快速回复:删除最后页最后一条记录问题
数据加载中...
 
   



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

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