| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 866 人关注过本帖, 1 人收藏
标题:哪位大哥能帮我这个菜鸟解释一下这个THANKS
只看楼主 加入收藏
huye1985
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2008-3-3
收藏(1)
 问题点数:0 回复次数:3 
哪位大哥能帮我这个菜鸟解释一下这个THANKS
<%
              SQL="Select * from product where pro_name='product'"
              Set rs=Server.CreateObject("ADODB.RecordSet")
            rs.Open SQL,con,1,1
            rs.PageSize=12
            count=1
            if Request("count")<>"" then
            count=Cint(Request("count"))
                if count<1 then
                    count=1
                end if
                if count>rs.PageCount then
                    count=rs.PageCount
                end if
            end if
            if not rs.Bof and not rs.Eof then
                  rs.ABSolutePage=count
              end if
            pagecountx=rs.pagecount
            for i=0 to 2
                if i*4>=rs.RecordCount-((count-1)*rs.PageSize) then
                    exit for
                end if    
          %>
搜索更多相关主题的帖子: count SQL THANKS 
2008-03-12 10:40
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
<%
              '构造SQL语句查询字符串
              'product可能是商品表
              'pro_name商品名称=product的所有数据
              '意思是查询商品表商品名称为product的所有数据
              SQL="Select * from product where pro_name='product'"
              Set rs=Server.CreateObject("ADODB.RecordSet")
              '建立记录集对象用来执行SQL语句取出数据
            rs.Open SQL,con,1,1
            '执行SQL语句并取出数据到记录集对象rs
            rs.PageSize=12
            '设置当前记录集数据分页显示,每页显示12条数据
            count=1
            '初始化count变量值为1
            '(这样写法个人不推荐,虽然执行没有错误,但是没有声明变量count
            '判断从上一个页面或URL地址传来的参数count是否为空
            if Request("count")<>"" then
            count=Cint(Request("count"))'将文本数据强制转换为数字整数数据
               '如果传来的count大于1则再次初始化count为1
               if count<1 then
                    count=1
                end if
                '如果count大于记录集数据分页的总页数
                if count>rs.PageCount then
                    count=rs.PageCount'将总页数给count变量
                end if
            end if
            '如果记录集有数据
            if not rs.Bof and not rs.Eof then
                  rs.ABSolutePage=count'将count变量传递给记录集的当前页属性,将记录集当前页只向count所在的页
              end if
            pagecountx=rs.pagecount'将总页数给变量pagecountx
            '循环2次
            for i=0 to 2
                '如果i乘以4大于等于总页数减coung-1乘以每页记录数
                if i*4>=rs.RecordCount-((count-1)*rs.PageSize) then
                    exit for'退出循环
                end if
                '这个if判断是一个算法,作什么用的还得看具体程序来分析   
          %>
2008-03-12 15:22
execoo
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2008-3-11
收藏
得分:0 
楼上的说的很详细啊。赞一个~~
建议LZ先多看看书,了解下先
2008-03-12 15:48
huye1985
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2008-3-3
收藏
得分:0 
回复 2# 的帖子
太感谢版主了
2008-03-14 10:00
快速回复:哪位大哥能帮我这个菜鸟解释一下这个THANKS
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014148 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved