zoukankan      html  css  js  c++  java
  • 分页存储过程



    CREATE PROCEDURE   stu_ProcedureName
        @pageindex int ,
        @pageSize int,
        @name nvarchar(50),
        @count int output
    as
    BEGIN
       
       if(@name='')
       begin
        set  @count=( select  count(1)  from ( select   ROW_NUMBER() over( order by student.id)   as newid , *   from student  ) t  where t.Names like '%'+@name+ '%')
        
         select  top(@pageSize) * from ( select   ROW_NUMBER() over( order by student.id)   as newid , *   from student  where Names like '%'+@name+ '%' ) t  where  t.newid >(@pageindex-1)*@pageSize
       end
        else
        begin
         set  @count=( select  count(1)  from ( select   ROW_NUMBER() over( order by student.id)   as newid , *   from student  ) t )
        
         select  top(@pageSize) * from ( select   ROW_NUMBER() over( order by student.id)   as newid , *   from student ) t  where  t.newid >(@pageindex-1)*@pageSize
        end
           

     
    END
    GO
    declare @count int;
    exec stu_ProcedureName 1,2,'1',@count out
    select @count

    嵌套类

        public class MM
        {
            public int newid { get; set; }
            public int id { get; set; }
            public string Names { get; set; }
            public int age { get; set; }
            public string adress { get; set; }

        }

        public class pageList<MM>
        {
            public int pageindex { get; set; }
            public int pagesize { get; set; }
            public int count { get; set; }
            public List<MM> shuju{get;set;}

        }

  • 相关阅读:
    IBM Tivoli Netview在企业网络管理中的实践(附视频)
    应用Linux远程桌面(附视频)
    轻松八步搞定Cacti配置安装(原创视频)
    从程序详解拒绝服务攻击
    基于Linux平台的Openvas配置使用视频教学
    Sco Unixware 7.1.3企业版服务器安装视频教程
    P1305-新二叉树
    P1087-FBI树
    P1115-最大子段和
    P1996-约瑟夫问题
  • 原文地址:https://www.cnblogs.com/yxlx/p/7879309.html
Copyright © 2011-2022 走看看