Asp.Net中的三种分页方式总结
--下方可以忽略
--我用到的是存储过程:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
create PROCEDURE [dbo].[pro_pager]
(@startIndex INT,
@endindex INT,
@strwhere varchar(200)
)
AS
SELECT tb_On_Tick_Info.On_Tick_ID_Int,tb_On_Tick_Info.On_Tick_SellDatetime_Dtm,tb_On_Tick_Info.On_Tick_TicketsNum_Str, tb_Department_Info.Dept_Name_Str, tb_User_Info.User_Name_Str,
tb_On_Tick_Info.On_Tick_SellNumber_Str, tb_On_Tick_Info.On_Tick_ShouldPay_Dec, tb_On_Tick_Info.On_Tick_Count_Int,
tb_On_Tick_Info.On_Tick_Discount_Dec, tb_On_Tick_Details.On_Tick_Details_StartNo_Int, CHARINDEX(N'a',
tb_On_Tick_Info.On_Tick_Note_Text) AS Expr3, tb_User_Info_1.User_Name_Str AS Expr1, tb_Ticket_Type.TicketType_Name_Dec,
COUNT( tb_On_Tick_Details.On_Tick_Details_ID_Int) AS Expr2 ,tb_Department_Info.Dept_ID_Int
into #temp
FROM tb_User_Info INNER JOIN
tb_On_Tick_Info ON tb_User_Info.User_ID_Int = tb_On_Tick_Info.On_Tick_SellPerson_Int INNER JOIN
tb_Department_Info ON tb_User_Info.User_DepartID_Int = tb_Department_Info.Dept_ID_Int INNER JOIN
tb_User_Info AS tb_User_Info_1 ON tb_On_Tick_Info.On_Tick_PayPerson_Int = tb_User_Info_1.User_ID_Int INNER JOIN
tb_On_Tick_Details ON tb_On_Tick_Info.On_Tick_SellNumber_Str = tb_On_Tick_Details.On_Tick_SellNumber_Str INNER JOIN
tb_Ticket_Type ON tb_On_Tick_Details.On_Tick_Details_TicketsType_Int = tb_Ticket_Type.TicketType_ID_Int
where 1=1 +@strwhere
GROUP BY tb_On_Tick_Info.On_Tick_SellDatetime_Dtm,tb_On_Tick_Info.On_Tick_TicketsNum_Str, tb_Department_Info.Dept_Name_Str, tb_User_Info.User_Name_Str,
tb_On_Tick_Info.On_Tick_SellNumber_Str, tb_On_Tick_Info.On_Tick_ShouldPay_Dec, tb_On_Tick_Info.On_Tick_Count_Int,
tb_On_Tick_Info.On_Tick_Discount_Dec, CHARINDEX(N'a', tb_On_Tick_Info.On_Tick_Note_Text), tb_User_Info_1.User_Name_Str,
tb_Ticket_Type.TicketType_Name_Dec, tb_On_Tick_Details.On_Tick_Details_StartNo_Int ,tb_Department_Info.Dept_ID_Int,tb_On_Tick_Info.On_Tick_ID_Int
declare @sql varchar(8000)
set @sql = 'select CONVERT(varchar(12) , On_Tick_SellDatetime_Dtm, 111 ) as On_Tick_SellDatetime_Dtm,Dept_Name_Str,User_Name_Str,On_Tick_SellNumber_Str,convert(varchar(15), On_Tick_ShouldPay_Dec) as On_Tick_ShouldPay_Dec,On_Tick_Count_Int,On_Tick_Discount_Dec'
select @sql=@sql+',sum(case tickettype_name_dec when '''+tickettype_name_dec+''' then expr2 else 0 end) ['+tickettype_name_dec+']'
from (select distinct tickettype_name_dec from tb_Ticket_Type ) as a
set @sql=@sql+' ,expr3,Expr1,On_Tick_TicketsNum_Str,Dept_ID_Int,On_Tick_ID_Int into ##t from #temp
group by On_Tick_SellDatetime_Dtm,Dept_Name_Str,On_Tick_TicketsNum_Str,User_Name_Str,On_Tick_SellNumber_Str,On_Tick_ShouldPay_Dec,On_Tick_Count_Int,
On_Tick_Discount_Dec ,expr3,Expr1,Dept_ID_Int,On_Tick_ID_Int order by On_Tick_SellDatetime_Dtm '
exec( @sql )
--select * from ##t
select * from (SELECT ROW_NUMBER() OVER(ORDER BY on_tick_id_int DESC) AS rownum,
* from ##t) as U
WHERE rownum between @startIndex and @endIndex
drop table ##t
- .NET Core系列之MemoryCache 初识
- 007手机一键Root(安机网一键Root) v3.0 官方最新版 一键ROOT您的Android手机
- 12306密码被盗了怎么办?12306密码外泄解决方法
- 12个字的qq网名
- 150M迷你型无线路由器怎么设置?
- 192.168.1.1打不开怎么办?路由器192.168.1.1打不开的原因以及解决办法
- 2011年电子报合订本 电子报 编辑部 中文 PDF版 [84M]
- 2015年1月15日小米新旗舰发布会现场图文直播
- 2016.3.1vivo Xplay5新品发布会现场视频直播 优酷直播
- 2016华为P9发布会视频直播地址 4月15日华为P9国行发布会直播