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
  • 相关阅读:
    Ubuntu中root用户和user用户的相互切换
    Linux扩展权限
    計蒜客/填志愿(匈牙利算法)
    計蒜課/排澇(Edmond-Karp)
    計蒜客/數正方形(dp)
    51nodcontest#24 A(xjb)
    計蒜客/节食的限制(01背包)
    計蒜客/小教官(xjb)
    atcoder#073D(枚舉)
    Educational Codeforces Round 20 C(math)
  • 原文地址:https://www.cnblogs.com/renzaijianghu/p/3454944.html
Copyright © 2011-2022 走看看