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

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

存儲過程分頁

[摘要]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取下一條記錄。




主站蜘蛛池模板: 亚洲国产天堂久久综合 | 日本五级床片午夜视频 | 婷婷狠狠干 | 四虎永久免费在线观看 | 孕妇三片高清在线观看 | 婷婷99精品国产97久久综合 | 亚洲福利午夜 | 日韩黄色一级片 | 日本在线观| 全黄性色大片 | 唐朝豪放女在线观看 | 亚洲黄色第一页 | 日本一区二区在线播放 | 亚洲图区欧美 | 天天综合天天操 | 伊人9| 一级黄色片免费播放 | 青娱乐精品在线 | 青草视频在线观看免费资源 | 亚洲成人一级片 | 中文字幕在线不卡 | 欧美网站视频 | 日韩精品在线免费观看 | 香蕉视频一区 | 三级国产视频 | 日韩 在线视频精品 | 欧美亚洲国产精品 | 日本不卡在线一区二区三区视频 | 色噜噜狠狠大色综合 | 新天堂网| 午夜在线观看视频 | 天天操天天爽天天射 | 在线bt在线www天堂网在线 | 四虎在线观看一区二区 | 天天色视频 | 午夜视频欧美 | 日韩黄色一级视频 | 亚洲人成影网站~色 | 色老头一级毛片 | 亚洲人成网站看在线播放 | 亚洲 欧美 另类 综合 日韩 |