日期:2014-05-17  浏览次数:21120 次

数据库中的表在网页中显示
数据库类型是mysql数据库名test用户名root密码test
使用asp分页显示在网页上 
每页8条记录
求源码???
最好是调试成功的

------解决方案--------------------
<%
dim i,intPage,page,pre,last,filepath
set rs = server.CreateObject("adodb.recordset")
sql="select root,test from tbname" //tbname是你的表名
rs.PageSize = 20 //(Yoko:这里设定每页显示的记录数
rs.CursorLocation = 3
rs.Open sql,conn,0,2,1 //(Yoko:'这里执行你查询SQL并获得结果记录集
pre = true
last = true
page = trim(Request.QueryString("page"))

if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs.PageCount then
intpage = rs.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rs.eof then
rs.AbsolutePage = intpage
end if
%>
<!--循环开始-->
 <%
for i=1 to rs.PageSize
if rs.EOF or rs.BOF then exit for
%>
..................
//(Yoko:要循环显示的内容 )..................
...................
<%
rs.movenext
next
%>
<!--循环体结束
分页部分:-->
 <table width="99%" border="1" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs.pagecount > 0 then%>
<td width="13%" align="left">当前页<%=intpage%>/<%=rs.PageCount%></td>
<%else%>
<td width="41%" align="left">当前页0/0</td><%end if%>
<td width="46%" align="right"> <a href="本页.asp?page=1">首页</a>| 
<%if pre then%>
<a href="本页.asp?page=<%=intpage -1%>">上页</a>| <%end if%>
<%if last then%>
<a href="本页.asp?page=<%=intpage +1%>">下页</a> |<%end if%>
<a href="本页.asp?page=<%=rs.PageCount%>">尾页</a>|转到第
<select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = intpage then%>
<option value="本页.asp?page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="本页.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>页</font> 
</td>
</tr>
</table>

------解决方案--------------------
<%
dim i,intPage,page,pre,last,filepath
set rs = server.CreateObject("adodb.recordset")
sql="select * from tb1 order by ID "
rs.PageSize = 8 //(Yoko:这里设定每页显示的记录数
rs.CursorLocation = 3
rs.Open sql,conn,0,2,1 //(Yoko:'这里执行你查询SQL并获得结果记录集
pre = true
last = true
page = trim(Request.QueryString("page"))

if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs.PageCount then
intpage = rs.PageCount