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

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

存儲過程分頁

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




主站蜘蛛池模板: 欧美性色一级在线观看 | 日韩亚洲欧美日本精品va | 四虎影视com88 | 四虎影院免费在线 | 伊人久久五月 | 日韩欧美中文字幕一区二区三区 | 一级成人a免费视频 | 探花网站 | 天堂精品 | 色综合久久综合网观看 | 倩女还魂在线观看完整版免费 | 亚洲欧美不卡 | 欧洲乱码专区一区二区三区四区 | 日本卡一卡2卡3卡4精品卡无人区 | 在线亚洲日产一区二区 | 亚洲天堂网视频 | 一级毛片免费视频 | 五月天婷婷激情 | 亚洲综合激情丁香六月 | 亚洲免费在线观看 | 天天操天天操天天操天天操 | 欧美一级片免费 | 亚洲人成影网站~色 | 欧美一区二区三区久久久人妖 | 午夜影视体验区 | 中文天堂在线视频 | 爽爽影院在线18观看 | 四虎影院免费观看视频 | 情侣国产 | 色妹子在线 | 欧洲精品视频完整版在线 | 日韩欧美爱爱 | 日本不卡免费新一区二区三区 | 日本中文不卡 | 日韩免费中文字幕 | 性导航app精品视频 性荡视频在线播放视频 | 亚洲aa在线 | 特片伦理在线网站 | 一区二区三区福利 | 欧美网站在线观看 | 日本免费乱理伦片在线观看2018 |