首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

小弟我做了个简单的asp新闻翻页系统,翻页有关问题,

2012-09-27 
我做了个简单的asp新闻翻页系统,翻页问题,在线等啊!急急急我做了个简单的asp新闻系统,就4个文件,谁能帮我

我做了个简单的asp新闻翻页系统,翻页问题,在线等啊!急急急
我做了个简单的asp新闻系统,就4个文件,谁能帮我看看问题处在那儿了啊?什么都不显示 news.asp, turnpage.asp,show.asp,conn.asp 还有个news.mdb,其中,news.mdb数据库的表名字也是news,数据库没有问题,因为,我的show.asp能正确的读出数据库中的新闻。现在是,那个翻页过程调用出问题了,或者news.asp页面出问题了!我折腾了2天都没折腾出来
conn.asp 文件
<%
dim conn ,connstr,rs_news
Connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("news.mdb") 
Set conn = Server.CreateObject("ADODB.Connection") 
Conn.Open Connstr 
%>

---------------
news.asp内容

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> 
<!--#include file="conn.asp"--> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
' <%
'Set rs_news="sever.createobjet("adodb.recodset")
'rs_news.open "slect *form news" conn 1, 3 
'%>
<%
set rs=server.CreateObject("adodb.recordset") '创建rs记录集
sql="select * from news" '读取数据库的SQL语句串
rs.open sql,conn,1,3 '打开记录集
%>

<HTML>
 <HEAD>
  <TITLE> 风雨亭新闻系统 </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>
 <BODY>
  <p align ="center" ><h1>风雨亭新闻系统 </h1> </p>
  <BR><BR><BR><BR><BR><BR>
  <!--#include="turnpage.asp" -->
  <br>
  ' 调用公共翻页
 <%
 Dim rowcount,rs_news
 rowcount=6 ' 定义每页显示新闻条目数
 Call turnpage(rs_news , rowcount) '调用公共翻页结束
 %>
 <%
 If Not rs_news.eof Do While Not rs_news.eof And rowcount>0 
 %>
<table whdth=100%>
  <tr>
  <td> 标题: </td>
<td> 内容 : </td>
<td> 时间 :</td>
  </tr>
  <tr>
  <td><%=rs_news("title")%> </td>
<td> <%=rs_news"content")%> </td>
<td> <%=rs_news("addtime")%> </td>
</tr>
</table>
<%
rowcount= rowcount - 1
rs_news.movenext
Loop
End if
%>
 </BODY>
</HTML>

-----------------------
turnpage.asp翻页过程页面

<%
Sub TurnPage(ByRef Rs_tmp,PageSize) 'Rs_tmp 记录集 ; PageSize 每页显示的记录条数;
Dim TotalPage '总页数
Dim PageNo '当前显示的是第几页
Dim RecordCount '总记录条数
Dim Rs_tmp 'Rs_tmp 记录集
Rs_tmp.PageSize = PageSize
RecordCount = Rs_tmp.RecordCount
TotalPage = INT(RecordCount / PageSize * -1)*-1
PageNo = Request.QueryString ("PageNo")
'直接输入页数跳转;
If Request.Form("PageNo")<>"" Then PageNo = Request.Form("PageNo")
'如果没有选择第几页,则默认显示第一页;
If PageNo = "" then PageNo = 1 
If RecordCount <> 0 then
Rs_tmp.AbsolutePage = PageNo
End If

'获取当前文件名,使得每次翻页都在当前页面进行;
Dim fileName,postion
fileName = Request.ServerVariables("script_name")
postion = InstrRev(fileName,"/")+1
'取得当前的文件名称,使翻页的链接指向当前文件;
fileName = Mid(fileName,postion) 
%>
<table border=0 width='100%'> 
<tr> 
<td align=left> 总页数:<font color=#ff3333><%=TotalPage%></font>页
当前第<font color=#ff3333><%=PageNo%></font>页</td>
<td align="right"> 
<%If RecordCount = 0 or TotalPage = 1 Then 


Response.Write "首页|前页|后页|末页"
Else%>
<a href="<%=fileName%>?PageNo=1">首页|</a>
<%If PageNo - 1 = 0 Then
Response.Write "前页|"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo-1%>">前页|</a>
<%End If

If PageNo+1 > TotalPage Then
Response.Write "后页|"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo+1%>">后页|</a>
<%End If%>

<a href="<%=fileName%>?PageNo=<%=TotalPage%>">末页</a>
<%End If%></td>
<td width=95>转到第
<%If TotalPage = 1 Then%>
<input type=text name=PageNo size=3 readonly disabled style="background:#d3d3d3">
<%Else%>
<input type=text name=PageNo size=3 value="" title=请输入页号,然后回车>
<%End If%>页
</td>
</tr>
</table>
<%End Sub%>



[解决办法]
不知道你说的翻页问题,具体什么问题?
是查询的参数没有带到下一页么?
[解决办法]
<!--#include file="conn.asp"-->
那你看这个文件里是否有容错代码,有容错代码就删掉或者注释掉
[解决办法]
你用response.write "1"
response.end
这样断句输出看看在什么地方出问题
[解决办法]

探讨
这个好难查啊,不晓得查到什么上海是个头哦!

热点排行