• <label id="pxtpz"><meter id="pxtpz"></meter></label>
      1. <span id="pxtpz"><optgroup id="pxtpz"></optgroup></span>

        當前位置:雨林木風下載站 > 技術開發(fā)教程 > 詳細頁面

        存儲過程分頁

        存儲過程分頁

        更新時間:2022-05-08 文章作者:未知 信息來源:網絡 閱讀次數(shù):

        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                      --如果不限定天數(shù)
                  begin
                        /*求符合條件記錄數(shù)*/
                        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                                --如果限定天數(shù)          

                  begin
                        /*求符合條件記錄數(shù)*/
                        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取下一條記錄。

        溫馨提示:喜歡本站的話,請收藏一下本站!

        本類教程下載

        系統(tǒng)下載排行

        主站蜘蛛池模板: 白白色免费在线视频| 亚洲av无码久久忘忧草| 亚洲hairy多毛pics大全| 欧洲乱码伦视频免费| 亚洲人成在线免费观看| 91精品国产免费久久久久久青草| 亚洲美女自拍视频| 成视频年人黄网站免费视频| 亚洲综合偷自成人网第页色| 毛片a级毛片免费观看免下载| 亚洲国产精品99久久久久久| 国产乱弄免费视频| 亚欧国产一级在线免费| 亚洲精品色午夜无码专区日韩| 国产一区二区三区免费观看在线| 亚洲日本一区二区三区| 18级成人毛片免费观看| 亚洲www在线观看| 久久精品免费一区二区喷潮| 亚洲av永久无码精品网址| 免费v片视频在线观看视频| 9久热精品免费观看视频| 无码久久精品国产亚洲Av影片| 日韩成人在线免费视频| 国产精品亚洲一区二区三区在线观看| 高清在线亚洲精品国产二区| 拍拍拍无挡免费视频网站| 毛片在线免费视频| 处破女第一次亚洲18分钟| 久久久久一级精品亚洲国产成人综合AV区 | 国产精品久久久久久亚洲小说| 亚洲电影日韩精品| 免费A级毛片无码A∨中文字幕下载| 亚洲国产高清美女在线观看| 国产做床爱无遮挡免费视频| 国产成人免费视频| 亚洲精品女同中文字幕| 国产亚洲福利精品一区| 成熟女人牲交片免费观看视频 | 亚洲无人区一区二区三区| aⅴ免费在线观看|