public IList<UserInfo> GetPageList(int pageSize, int pageIndex, out int totalItemCount)
{
var totalSql = "SELECT COUNT(1) FROM UserInfo";
Object result = GetScalar(totalSql);
totalItemCount = result == null ? : ConvertHandler.ToInt32(result);
var sql = string.Format(@"SELECT u2.n, U.* FROM UserInfo U,
(SELECT TOP {0} row_number() OVER (ORDER BY Name DESC) n, CODE FROM UserInfo)
u2 WHERE U.CODE = u2.CODE AND u2.n >= {1} ORDER BY u2.n ASC",
((@pageIndex - ) * @pageSize) + @pageSize, ((@pageIndex - ) * @pageSize) + );
return GetList(sql);
}
网上选了个分页的SQL,凑合够用。程序本地,数据库万网空间附带的MSSQL 2008,如果数据库放本地不知道能快多少。