C# 对sql通用分页方法



DECLARE @indexTabel TABLE(Nid int IDENTITY(1,1) PRIMARY KEY,aId int)

INSERT INTO @indexTabel 
Select bc.Id From XX bc With(NOLOCK) Where 1=1 AND bc.DataFlag=1  and bc.CreateDate > ='2016-03-01'  
and bc.CreateDate < '2016-03-31'   
order by bc.Id desc

SELECT @@ROWCOUNT;


Select bc.Id,bc.*  
From XX bc With(NOLOCK)
INNER JOIN @indexTabel it on it.aId=bc.Id 
WHERE  it.Nid>11 AND  it.Nid< 21 order by it.Nid
        


你可能感兴趣的:(C# 对sql通用分页方法)