xxxx
;WITH Tab AS ( SELECT CAST(ROW_NUMBER()OVER(ORDER BY CC.CreateTime DESC) AS INT) AS Sequency, CONVERT(INT ,COUNT(1) OVER()) AS TotalRecords FROM dbo.CC CC ) SELECT *FROM Tab WHERE Sequency BETWEEN (@PageIndex - 1 ) * @PageSize + 1 AND @PageIndex * @PageSize ORDER BY Sequency;
/* 注意: - 1、定义的Model的各个属性的名称要和Select语句执行结果的列名一致 - 2、定义的Model的各个属性的数据类型要和数据库定义的一致 - 3、关于数据列与属性对应:Model中的属性SQL里面可以没有,值会默认为Null/0;但是SQL结果里面有的列名必须在Model中存在。否则会报错! */
罪魁祸首
ROW_NUMBER()返回的bigint类型的,而Model的属性定义的int类型...
xxx