Sign-up....

asp分页打印问题(高分相送)

例如:数据库里有100条记录,我需要分4页打印出来,每页显示25条记录,而且每页需要把表格头显示出来。

我想用一个循环在在一个页面中把这4页分别列出来,每部分之间加上强制打印,下面是我的源码,请看看哪错了,为什么只显示第一页的信息

<%

page=1

set rs0 = Server.CreateObject ("ADODB.RecordSet")

sql="select * from JF11 order by ID desc"

with rs0

.ActiveConnection = Conn

.CursorType = 3

.LockType = 3

.pagesize = 5

.Open sql

End With

if not rs0.EOF then

do while page<rs0.PageCount

%>

<table width="100%" border="1" cellspacing="0" cellpadding="0">

<tr>

<td width="15%"><div align="center">行政区划代码</div></td>

<td width="10%"><div align="center">报告期年月</div></td>

<td width="9%"><div align="center">姓名</div></td>

<td width="18%"><div align="center">公民身份证号码</div></td>

<td width="14%"><div align="center">个人编号</div></td>

<td width="8%"><div align="center">性别</div></td>

<td width="14%"><div align="center">失业登记日期</div></td>

<td width="12%"><div align="center"><%=rs0.pagecount%></div></td>

</tr>

<%

set rs = Server.CreateObject ("ADODB.RecordSet")

sql="select * from JF11 order by ID desc"

with rs

.ActiveConnection = Conn

.CursorType = 1

.LockType = 1

.pagesize = 5

.Open sql

End With

if not rs.EOF then

rs.AbsolutePage = page

do while i<rs.PageSize

%>

<%

set rs1 = Server.CreateObject ("ADODB.RecordSet")

rs1.open"select Name from SY_areaCode where Area_ID = '"&rs(1)&"'",conn,1,1

set rs2 = Server.CreateObject ("ADODB.RecordSet")

rs2.open"select Name from SY_SexCode where Sex_ID = '"&rs(7)&"'",conn,1,1

%>

<tr>

<td align="center"><%=rs1("Name")%> </td>

<td align="center"><%=rs(2)%> </td>

<td align="center"><%=rs(3)%> </td>

<td align="center"><%=rs(4)%> </td>

<td align="center"><%=rs(5)%> </td>

<td align="center"><%if rs(7)<>" then%>

<%=rs2("Name")%>

<%end if%>  </td>

<td align="center"><%=rs(12)%> </td>

<td align="center"><a href="Sy_Edit.asp?Id=<%=rs("Id")%>">修改</a></td>

</tr>

<%

i=i+1

rs.movenext

loop

%>

<%

end if%>

</table>

<p style='page-break-before:always;'>

<%

page=page+1

rs0.MoveNext

loop

%>

<%end if%>

[2145 byte] By [msdn] at [2007-8-14 9:08:54]
# 1 Re: asp分页打印问题(高分相送)
这个我知道啊,但是怎么把数据库里数据的内容写进去呢
photojjc at 2005-05-23 11:41:00 >
# 2 Re: asp分页打印问题(高分相送)
在要分页的元素前加上这个 style="PAGE-BREAK-BEFORE: always"
chzxq at 2005-05-23 11:49:00 >
# 3 Re: asp分页打印问题(高分相送)
上面说的都是静态页面分页,我的意思是如何实现每取出25条数据则添加 style="PAGE-BREAK-BEFORE: always"
photojjc at 2005-05-23 11:59:00 >
# 4 Re: asp分页打印问题(高分相送)
学习中···
sunshift at 2005-05-23 12:08:00 >

Web

All Classified