首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

实现数据库分页解决方法

2012-04-12 
实现数据库分页SQLSERVER 2005中实现分页的SQL语句是什么呢?利用ASP.NET技术怎样在网页中实现分页?[解决办

实现数据库分页
SQL SERVER 2005中实现分页的SQL语句是什么呢?利用ASP.NET技术怎样在网页中实现分页?

[解决办法]
select ceiling(2.1)
----方法1:
WITH UserInfos AS
(
select *,row_number() over(order by user_id) as RowNumber
from user_info
)
select *
from UserInfos
where RowNumber between 21 and 30

----方法2:
select * from
(
select *,row_number() over(order by user_id desc) as RowNumber
from user_info
) A
where RowNumber between 21 and 30

----方法3:
select top 10 * from user_info 
where user_id not in
(
select top 20 user_id from user_info 
order by user_id
)
order by user_id

----方法4:
SELECT TOP 10 *
FROM user_info
WHERE (user_id >
(SELECT MAX(user_id)
FROM (SELECT TOP 20 user_id
FROM user_info
ORDER BY user_id) AS T))
ORDER BY user_id

----方法5:
select *
from
(
select top 10 *
from 
(
select top 30 *
from user_info
order by user_id
) A
order by user_id desc
) B
order by user_id 







[解决办法]

探讨

select ceiling(2.1)
----方法1:
WITH UserInfos AS
(
select *,row_number() over(order by user_id) as RowNumber
from user_info
)
select *
from UserInfos
where RowNumber between 21 and 30

----方……

热点排行