欢迎光临
我们一直在努力

建站超值云服务器,限时71元/月

create proc up_gettopiclist
       @a_strforumid varchar(50) ,
       @a_intpageno int  ,
       @a_intpagesize int
as
   /*定义局部变量*/
   declare @intbeginid         int
   declare @intendid           int
   declare @introotrecordcount int
   declare @intpagecount       int
   declare @introwcount        int
   /*关闭计数*/
   set nocount on
   
  
   /*求总共根贴数*/
   select @introotrecordcount = count(*) from bbs_topic where fatherid=0 and forumid=@a_strforumid
   if (@introotrecordcount = 0)    –如果没有贴子,则返回零
       return 0
       
   /*判断页数是否正确*/
   if (@a_intpageno – 1) * @a_intpagesize > @introotrecordcount
      return (-1)

   /*求开始rootid*/
   set @introwcount = (@a_intpageno – 1) * @a_intpagesize + 1
   /*限制条数*/
   set rowcount @introwcount
   select @intbeginid = rootid from bbs_topic where fatherid=0 and forumid=@a_strforumid
          order by tid desc

   /*结束rootid*/
   set @introwcount = @a_intpageno * @a_intpagesize
   /*限制条数*/
   set rowcount @introwcount
   select @intendid = rootid from bbs_topic where fatherid=0 and forumid=@a_strforumid
          order by tid desc

   /*恢复系统变量*/
   set rowcount 0
   set nocount off   

   select a.tid , a.layer , a.forumid , a.subject , a.faceid , a.hits , a.posttime , a.userid , a.fatherid , a.rootid ,
         bytes = datalength(a.content) , b.loginname  , b.email  , b.homepage , b.signature , b.point
     from bbs_topic as a join bbs_user as b on a.userid = b.uid
     where forumid=@a_strforumid and a.rootid between @intendid and @intbeginid
         order by a.rootid desc , a.ordernum desc
   return(@@rowcount)
   –select @@rowcount
go    

怎么操作就不贴了!!大家好好看看,

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 »
分享到: 更多 (0)

相关推荐

  • 暂无文章