文章·资料 电脑软件 手机应用 网站源码




    本 站 搜 索
   推 荐 文 章        More...
华硕易电脑(ASUS Eee PC 1025C)..
先来段开场白:为了外出携带方便,到淘..
Acronis True Image 使用说明
  一款可以在Windows下使用全部功..
Norton Ghost 使用详解
一、分区备份   使用Ghost进行系..
    文 章 阅 读 排 行
Microsoft SQL Server 2000 Perso..
  对于第一次安装 Microsoft SQL Se..
MD5 算法的ASP实现代码
  MD5的全称是Message-Digest Algor..
BIOS 设置不能修改等问答5则
  问:电脑配置为:微星865PE主板、P4..
Windows 系统修改默认文件类型图标
Windows 系统文件类型图标,通常由默..
夸克网盘新用户注册如何获得1T空间
夸克网盘,新用户注册如何获得1T空间? ..
VMware Workstation:新添加的硬..
VMware Workstation 新添加的硬盘不..
CMD:Windows 系统 CMD 命令添加..
查看全部用户账号: net user 查..
Microsoft Internet Information ..
  简称:IIS,版本:5.0,运行环境:Wind..
关于使用 CSS 来控制 table 标签..
  在 HTML 语言中,table 标签的 cel..
使XHTML Strict 支持 target 标签
XHTML 1.0 Strict 之后就不支持 targe..
 文 章 信 息
关于控制显示数据库记录的代码
评论()〗〖留言〗〖收藏
〖文章分类:电脑·手机·网络 / 网站设计·开发·优化〗〖阅读选项
ADMIN:
    您好!前几天在贵网提问的同时上传OLE、文本的问题已经得到解决,现在在调用数据库记录显示的时候碰到了新问题!请求贵网能够帮助解决!
    在此将代码提供如下,要求显示的结果是5行3列,多余的记录进行翻页。
    <%     
dim filename,postion
filename=request.servervariables("script_name")
postion=instrrev(filename,"/")+1
filename=mid(filename,postion)
  set rs=Server.CreateObject("adodb.recordset")     
  sql="SELECT * FROM chanpin ORDER BY id DESC"     
  rs.Open sql,conn,1,1  
  %>
<%
if not(rs.bof and rs.eof)then
pages=6 '控制每页显示的条目数
rs.pagesize=pages
if not isempty(request.querystring("page"))then
thispage=clng(request.querystring("page"))
else
thispage=1
end if
rscount=rs.recordcount
if thispage="" then thispage=1
if thispage<1 then thispage=1
if(thispage-1)*pages>rscount then
if(rscount mod pages)=0 then
thispage=rscount\pages
else
thispage=rscount\pages+1
end if
end if
if(rscount mod pages)=0 then
allpages=rscount\pages
else
allpages=rscount\pages+1
end if
rs.absolutepage=thispage
i=1
%>
        <tr><%do while not rs.eof and pages>0%><td width="200"><p>
          </p>
          </td>
          <td width="200"><p>名称:<%=rs("mingcheng")%> </p>
            <p>规格:<%=rs("guige")%> </p>
            <p>价格:<%=rs("jiage")%> </p>
            <p>详细信息:<%=rs("xiangxi")%> </p>
          <p>图像: <img src=showing.asp?id=<%=rs("id")%> width="100" height="100"></p></td>
<%
if(i mod 1)=0 then
%> 
</tr>
<%end if%>
          <%
    pages=pages-1
rs.movenext
i=i+1
loop
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
    </table>
<table width="61%" border="0" align='center'>
<tr>
<td><center>
共<%=allpages%>页 当前第<%=thispage%>页 
<% if thispage<>1 then %>
<a href="<%=filename&"?page=1"%>">首页</a>
<a href="<%=filename&"?page="&(thispage-1)%>">上页</a>
<% end if %>
<% if thispage<>allpages then %>
<a href="<%=filename&"?page="&(thispage+1)%>">下页</a>
<a href="<%=filename&"?page="&allpages&""%>">末页</a>
<%end if%>
</center></td>
</tr>
</table>

文章作者:未知  更新日期:2006-09-07
〖文章浏览:〗〖发送文章〗〖打印文章