六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

存儲過程分頁

[摘要]if exists(select * from sysobjects where ID = object_id("up_TopicList")) drop proc up_T...
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取下一條記錄。




主站蜘蛛池模板: 亚洲产国偷v产偷v自拍色戒 | 亚洲va欧美va国产综合下载 | 午夜www| 日韩三级免费看 | 日韩国产免费一区二区三区 | 伊人热人久久中文字幕 | 青青青爽国产在线视频 | 综合欧美亚洲 | 天堂8中文在线bt | 婷婷综合激情五月中文字幕 | 天天干天天干天天干天天 | 新久草视频 | 天天射天天干天天插 | 丝袜美腿护士办公室在线观看 | 亚洲欧美另类综合 | 亚洲欧美日韩国产色另类 | 情欲天堂| 欧美一级xxxx俄罗斯一级 | 亚洲图片色 | 日韩三集片 | 欧美一区日韩精品 | 日韩欧美亚洲国产精品字幕久久久 | 欧美一区二区三区免费观看视频 | 亚洲国产精品一区二区久久hs | 亚洲欧美日韩成人网 | 青草视频在线播放 | 一a一级片 | 亚洲高清综合 | 青草久久精品亚洲综合专区 | 最新日韩精品 | 天天色国产| 日日插夜夜操 | 青青青免费观看在线视频高清 | 欧美综合视频 | 伊人婷婷色香五月综合缴激情 | 一级午夜 | 一二三中文乱码亚洲乱码 | 欧美性野久久久久久久久 | 日本啊v在线观看 | 日本成人免费在线观看 | 日韩理论片西瓜影音 |