问一个很简单的问题 就是不会了
从数据库里取数据在页面上每行三个显示
这段程序怎么写呀
我都糊涂了
问题点数:20、回复次数:12Top
1 楼alexzhang00(三角猫)回复于 2003-11-01 12:05:03 得分 5
rs.open select * from table,dbconnection,1,1
if rs.eof then
rs.close
response.end
end if
for i=0 to rs.recordcount - 1
response.write rs(i)
if i mod 2 = 0 then response.write "<br>"
next
rs.close
set rs = nothing
Top
2 楼alexzhang00(三角猫)回复于 2003-11-01 12:06:25 得分 0
不好意思,上面有点问题:
是
response.write rs(0)
其他的多字段,和这个思路一样Top
3 楼maxid(快乐CODING)回复于 2003-11-01 12:07:28 得分 5
Do While Not Rst.Eof
Response.Write Rst("field")
Rst.MoveNext
If Rst.Eof Then Exit Do
Response.Write Rst("field")
Rst.MoveNext
If Rst.Eof Then Exit Do
Response.Write Rst("field")
Rst.MoveNext
Response.Write "<br>"
If Rst.Eof Then Exit Do
LoopTop
4 楼lastman001()回复于 2003-11-01 12:10:11 得分 0
谢谢了
试试Top
5 楼lastman001()回复于 2003-11-01 12:29:20 得分 0
不行呀
分页就不管用了Top
6 楼alexzhang00(三角猫)回复于 2003-11-01 12:45:49 得分 5
我的方法不存在分页的问题,肯定你自己写的有问题Top
7 楼maxid(快乐CODING)回复于 2003-11-01 13:56:10 得分 5
因为你一行是显示3条记录的,就是说你一页显示5行的就是15条记录,总页数就是Cint(Rst.RecordCount/15)左右,自己换算一下就行了Top
8 楼lastman001()回复于 2003-11-01 14:08:54 得分 0
谢谢Top
9 楼jingxiaoping(我知道你今天没有穿内衣,因为我看到了极其突出的两点)回复于 2003-11-01 14:15:48 得分 0
我的有比较全的程序,支持分页
如下,里面的内容自己修改就行了
<%
p=request("p")
if p="" then p=1
%>
<table width="80%" bordercolordark="#FFFFFF" cellspacing="0" cellpadding="0" align="center" height="70" border="1" bordercolor="#000000">
<tr>
<td valign="top" bgcolor="#F0F0F0">
<table border="0" cellspacing="1" width="100%">
<%
set rs=server.createobject("adodb.recordset")
rs.open "连接串内容",cn,1,3
rs.pagesize=60
if rs.recordcount<>0 then
rs.absolutepage=cint(p)
ti=0
while not rs.eof and ti<rs.pagesize
if ti=0 then
%>
<tr>
<%
end if
if ti mod 3=0 and ti<>0 then
%>
</tr>
<tr>
<%
end if
%>
<td width="33%" height="25" >
内容</td>
<%
ti=ti+1
rs.movenext
wend
%>
</table>
</td>
</tr>
<tr>
<td height="35" colspan="2" >
<p style="margin-left: 12; margin-right: 12">当前第<font color="#FF0000"><%=p%></font>页
共<font color="#FF0000"><%=rs.pagecount%></font>页 共<font color="#FF0000"><%=rs.recordcount%></font>条信息
<a href="当前页.asp?p=1">首页</a> <%if p>1 then%><a href="当前页.asp?p=<%=p-1%>">上一页</a><%else%>上一页<%end if%> <%if p-rs.pagecount=0 then%>下一页<%else%><a href="当前页.asp?p=<%=p+1%>">下一页</a><%end if%>
<a href="当前页.asp?p=<%=rs.pagecount%>">末页</a>
</td>
</tr>
<%
else
%>
<tr>
<td colspan="2" height="25" align="center">
暂无任何会员加盟!
</td>
</tr>
<%
end if
%>
</table>Top
10 楼lastman001()回复于 2003-11-01 14:17:46 得分 0
试试Top
11 楼leon168(www.doaspx.com [Asp.Net电子书资料下载])回复于 2003-11-01 15:05:01 得分 0
你的问题就是一个分页问题吗,到FAQ或者精华区去找找,很多的Top
12 楼lastman001()回复于 2003-11-01 15:20:32 得分 0
不仅仅是分页
单纯的分页我会亚Top




