zoukankan      html  css  js  c++  java
  • Linq转成sql后的分页方法

    sql 分页
    -- Region Parameters
    declare @pageindex int
    set @pageindex=2
    set @pagesize=10 DECLARE @p0 Int
    = ((@pageindex-1)*@pagesize)+1 --11 DECLARE @p1 Int =((@pageindex-1)*@pagesize)+@pagesize --20
    @pagesize --10 -- EndRegion SELECT [t1].[CustomerID], [t1].[CompanyName], [t1].[ContactName], [t1].[ContactTitle], [t1].[Address], [t1].[City], [t1].[Region], [t1].[PostalCode], [t1].[Country], [t1].[Phone], [t1].[Fax] FROM ( SELECT ROW_NUMBER() OVER (ORDER BY [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]) AS [ROW_NUMBER], [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax] FROM [Customers] AS [t0] ) AS [t1] WHERE [t1].[ROW_NUMBER] BETWEEN @p0 + 1 AND @p0 + @p1 ORDER BY [t1].[ROW_NUMBER]
    分页存储过程
    
    create procedure update 
    (@pagesize int,
    @pageindex int,
    @docount bit)
    as
    if(@docount=1)
    select count(*) from AAAAA
    else
    begin
     with temptbl as (
    SELECT ROW_NUMBER() OVER (ORDER BY ID desc)AS Row, * from AAAAA O )
     SELECT * FROM temptbl where Row between (@pageindex-1)*@pagesize+1 and (@pageindex-1)*@pagesize+@pagesize
    end
  • 相关阅读:
    JQuery实现页面跳转
    CSS中让背景图片居中且不平铺
    C#后台将string="23.00"转换成int类型
    BootStrap的一些基本语法
    CSS实现文字阴影的效果
    BootStrap自定义轮播图播放速度
    BootStrap 轮播插件(carousel)支持左右手势滑动的方法(三种)
    C#常用快捷键
    jQuery hover() 方法
    鼠标移动有尾巴
  • 原文地址:https://www.cnblogs.com/renzaijianghu/p/3454944.html
Copyright © 2011-2022 走看看