注册 登录
编程论坛 ASP.NET技术论坛

分页控件加了查询条件应该怎么用

夜龙魂 发布于 2009-11-16 10:10, 1012 次点击
with temptable as
(
    select row_number() over(order by cid ) rowid,* from customertable

)
    select * from temptable where rowid between 1(@pageStarIndex) and 1+2-1(@pageStarIndex+@pageSize-1)

这是没有查询条件的用法

但是我现在想加查询条件应该怎么用请大家帮忙我是这样写的不行
with temptable as
(
    select row_number() over(order by cid ) rowid,* from customertable

)
    select * from temptable where rowid between 1(@pageStarIndex) and 1+2-1(@pageStarIndex+@pageSize-1) and (clientitem='' or sinfoname='余露' or clientco='' or times='') order by times desc
2 回复
#2
冰弦冷瑟2009-11-16 14:10
分页控件(PagedDataSource)跟查询条件没有关系,查询方法返回的是一个List,分页控件是对这个List进行操作。所以SQL语句该怎么写还怎么写。
#3
冰彩虹2009-11-16 16:15
查询条件应该加在:

with temptable as
(
    select row_number() over(order by cid ) rowid,* from customertable where ....
)
....
1