1.
用next()方法,
选从50-100行
int CurrentRow = 1;
int MinRow = 50;
int MaxRow = 100;
while(rs.next())
{
if (CurrentRow {
CurrentRow++;
continue;
}
}
2.
用absolute(int row)定位
先定位到50行,然后next();
3.
用sql完成
SqlServer的语句:select top 50 * from (select top 100 * from sysobjects order by id) as a order by id desc
Oracle的语句:
select * from (select rownum r ,* from test) ss
where ss.r > 50 and ss.r <= 100;
测试速度 :
absolute()最慢;定位到10000条以后无法忍受!
next();前面几条快,越往后越慢!
SqlServer语句,比next快很多,但也是越往后越慢!
Oracle语句,最快!几乎不受条数影响!
【注:本文由控件中国网转载】