請各位大俠幫忙指教下面分頁程式,因為運行時只顯示第一頁內容,並且沒有超連接的功能,急!!謝謝先

reedchen 2003-12-11 04:23:18
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">

</head>


<body> 

<%
Set Conne = Server.CreateObject("ADODB.Connection")
conne.open "Driver={MySQL ODBC 3.51 Driver};" & "server=te-lab; uid=TEUser; pwd=teuser; database=tedb_01; autotranslate=false"
Set RS=Server.CreateObject("ADODB.RecordSet")
sql="select * from dqs"
rs.open sql,conne,1,3,1
%>

<%
dim maxpages

dim totalrecord

dim TotalPages




if not isempty(Request.QueryString("page")) then
thepage=cint(Request.QueryString("page"))
else
thepage=1
end if %>
<%

if not rs.eof then '在最後結束
rs.pagesize=6
totalrecord=rs.recordcount
totalpages=rs.pagecount
maxpages=rs.pagesize


if thepage>totalpages or thepage<=0 then
thepage=1
showContent

else
rs.absolutepage=thepage

showContent
end if

rs.close
set rs=nothing
conne.close
set conne=nothing
%>



<%sub showContent%>

<center>

<input type="hidden" name="thepage" value="<% =thepage %>">



<% dim i
i=1
do while not rs.eof
%>
<table>
<TBODY>

<tr bgcolor=#f1fce4>

<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 90px"
> <P align=center><FONT size=2><%=RS("TENo") %></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 90px"
> <P align=center><FONT size=2><%=rs("ProductType")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 90px"
> <P align=center><FONT size=2><%=rs("ItemName")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 90px"
> <P align=center><FONT size=2><%=rs("ChnName")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 70px"
> <P align=center><FONT size=2><%=rs("PropertyNo")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 45px"
> <P align=center><FONT size=2><%=rs("Quantity")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 45px"
> <P align=center><FONT size=2><%=rs("LeftQuantity")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 85px"
> <P align=center><FONT size=2><%=rs("DestroyedDate")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 150px"
> <P align=center><FONT size=2><%=rs("Reason")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 150px"
> <P align=center><FONT size=2><%=rs("Action")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 85px"
> <P align=center><FONT size=2><%=rs("RepairedDate")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 70px"
> <P align=center><FONT size=2><%=rs("Owner")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 85px"
> <P align=center><FONT size=2><%=rs("TargetDate")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 85px"
> <P align=center><FONT size=2><%=rs("ActualDate")%></FONT></P></TD>
<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 60px"
> <P align=center><FONT size=2><%=rs("Status")%></FONT></P></TD>

<TD borderColor=#9400d3 style="HEIGHT: 40px; WIDTH: 150px"
> <P align=center><FONT size=2><%=rs("Remark")%></FONT></P></TD>
<% i=i+1
if i>=maxpages then%>
<% exit do%>
<%end if%>
<% rs.movenext%></tr>
<% loop%></center></TBODY></table>



<table>
<% If thepage>=1 Then %>

<% showpages '顯示分頁情況 %>

<%end if%>


<% end sub%>

<%
else
response.write "<font size='4' color='#000000'>現在沒有有內容。</font>"
rs.close
set rs=nothing
conne.close
set conne=nothing
end if
%>

<%

Sub showpages

if thepage=1 then

Response.Write "【首頁】"
Response.Write "【上一頁】"

else %>

<% Response.Write "<A href=line.asp>【首頁】</A>"

Response.Write "<A href=line.asp?Page=" & (thepage-1) &">【上一頁】</A>"%>

<% end if

if totalpages-thepage<1 then
Response.Write "【下一頁】"
Response.Write "【尾頁】"
else %>

<% Response.Write "<A href=line.asp?Page=" & (thepage+1) &">【下一頁】</A>"
Response.Write "<A href=line.asp?Page=" & totalPages &">【尾頁】</A>" %>

<%end if%>


<% Response.Write "【第<font color=#000000>" & thepage & "</font>頁】"

Response.Write "【共<font color=#000000>" & totalpages & "</font>頁】"
Response.Write "【共<font color=#ff0000>" & totalrecord & "</font>條記錄】"


End Sub



%>

</CENTER>
<center>

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

...全文
33 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
blue_butterfly 2003-12-11
  • 打赏
  • 举报
回复
将rs.close
set rs = nothing
set conne = nothing

放到本页程序最末端,翻页时仍然需要记录集的

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧