动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > ASP技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ ASP技巧 ]的信息

本月文章推荐
.RS.OPEN SQL,CONN,A,B 全接触.
.水晶报表打印单据时增加空行或空.
.关于打印页面的一些经验.
.格式化数字函数FormatNumber.
.小工具:统计有多少行JS代码和AS.
.提供一种“间接防止另存为”的方.
.如何用ASP生成XML数据文档(RSS订.
.使用JMail组件代替Sql Mail发送E.
.在网页中实现OICQ里的头像选择的.
.remote script文档(转载自微软)(.
.一个在vbscript中读取cookie的程.
.客户端脚本验证码总结.
.用ASP编程控制在IIS建立Web站点的.
.bbs的树状算法的补充程序.
.用ASP实现从SQL Server导出数据到.
.如何用ASP创建日志文件.
.ASP如何使用MYSQL数据库.
.ASP调用ORACLE存储过程并返回结果.
.Microsoft 脚本编码器Script Enc.
.ASP实现OICQ式的信息收发功能.

存储过程分页

发表日期:2001-2-20 |


if exists(select * from sysobjects where ID = object_id("up_TopicList"))
   drop proc up_TopicList
go

create proc up_TopicList
            @a_ForumID int , @a_intDays int , @a_intPageNo int , @a_intPageSize tinyint
   as
       declare @m_intRecordNumber int
       declare @m_intStartRecord  int
       select @m_intRecordNumber = @a_intPageSize * @a_intPageNo
       select @m_intStartRecord = @a_intPageSize * (@a_intPageNo - 1) + 1

       if @a_intDays = 0                      --如果不限定天数
          begin
                /*求符合条件记录数*/
                select "RecordCount" = count(*)                         
                       from BBS where Layer=1 and ForumID = @a_ForumID

               /*输出纪录*/
               /*首先定义可滚动光标*/
               set rowcount @m_intRecordNumber
               declare m_curTemp Scroll cursor
                       for
                          select a.ID ,a.Title , d.UserName , a.FaceID ,
                                'ContentSize' = datalength(a.Content) ,
                                'TotalChilds' = (select sum(TotalChilds)
                                                        from BBS as b
                                                        where a.RootID = b.RootID) ,
                                'LastReplyTime' = (select max(PostTime)
                                                          from BBS as c
                                                          where a.RootID = c.RootID)
                                from BBS as a
                                     join BBSUser as d on a.UserID = d.ID
                                where Layer=1 and ForumID = @a_ForumID
                                order by RootID desc , Layer , PostTime
               open m_curTemp
               fetch absolute @m_intStartRecord from m_curTemp
               while  @@fetch_status = 0
                      fetch next from m_curTemp

               set rowcount 0
               /*清场*/       
               CLOSE m_curTemp
               DEALLOCATE m_curTemp
          end                      
                          
       else                                --如果限定天数          

          begin
                /*求符合条件记录数*/
                select "RecordCount" = count(*)                         
                       from BBS where Layer=1 and ForumID = @a_ForumID
                                      and dateadd(day , @a_intDays , PostTime) > getdate()

               /*输出纪录*/
               /*首先定义可滚动光标*/
               set rowcount @m_intRecordNumber
               declare m_curTemp Scroll cursor
                       for
                          select a.ID ,a.Title , d.UserName , a.FaceID ,
                                'ContentSize' = datalength(a.Content) ,
                                'TotalChilds' = (select sum(TotalChilds)
                                                        from BBS as b
                                                        where a.RootID = b.RootID) ,
                                'LastReplyTime' = (select max(PostTime)
                                                          from BBS as c
                                                          where a.RootID = c.RootID)
                                from BBS as a
                                     join BBSUser as d on a.UserID = d.ID
                                where Layer=1 and ForumID = @a_ForumID
                                      and dateadd(day , @a_intDays , PostTime) > getdate()
                                order by RootID desc , Layer , PostTime
               open m_curTemp
               fetch absolute @m_intStartRecord from m_curTemp
               while  @@fetch_status = 0
                      fetch next from m_curTemp

               set rowcount 0
               /*清场*/       
               CLOSE m_curTemp
               DEALLOCATE m_curTemp
          end                                                
go


注:若在asp中调用存储过程的command对象为cm,则set rs=cm.execute,然后用set rs=rs.nextrecordset取下一条记录。

上一篇:结束ADOVB.INC的办法 人气:9777
下一篇:友情连接浏览器 人气:7702
浏览全部的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-8-27 风讯dotNETCMS v1.0 SP3 SQL/ACC
2008-8-27 风讯dotNETCMS v1.0 SP3 源码
2008-8-27 时尚DJ舞曲小偷 v3.0
2008-8-27 多用户QQ空间播放器
2008-8-27 非零坊幽默短信 v3.3
2008-8-27 Pcook CRM客户资源管理系统 v2.0
2008-8-27 乐铺网店系统免费普及版 v3.40
2008-8-27 非零坊个人作品管理 v3.1
2008-8-27 凹丫丫简单会员信息管理系统
2008-8-23 Mini WinMount V0.4
2008-8-23 Vista优化大师3.11正式版
2008-8-23 Wine 1.13
2008-8-23 KlipFolio 5.0 Build 5899-80
2008-8-23 Windows Sysinternals Desktops
2008-8-23 OneTap Movies1.2破解版
2008-8-23 AnnotaterPDF阅读1.1.503 破解版
2008-8-23 SoundMeter分贝测量仪 v1.0汉化破
2008-8-23 iDrum音乐节拍1.0破解版
  发表评论
姓 名: 验证码:
内 容:
站长工具:网站收录查询 | Google PR查询 | ALEXA排名查询 | CSS在线编辑器 | 广告代码 | Html转换js | js/vbs加密 | md5加密 | 进制转换
实用工具:汉字翻译拼音 | 符号对照表 | 个税计算 | 经典小工具 | 汉字简繁转换 | 普通单位换算 | 公制单位换算 | 生辰老黄历 | 国内电话区号 国家代码与域名缩写 | 文字加密解密 | 健康查询 | 万年历 | 汉字横竖排版 | 手机号码查询 | 计算器 | ip搜索
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報
防水工事·改修工事 フットサル大会 探偵