我的表里有1368条数据,id是从1开始自增长,我写了一个循环:
for (int i = 1; i < table.rows.count/100; i++)
{
string comtext = "select * from table where id between " + 100 * (i - 1)+1 + " and " + 100 * i;
..................
}
结果最多只能取到id为1300,1301-1368的取不出来,请问有什么方法可以根据id取出所有的数据?前提是无法预知表中的数据总条数,谢谢大能们。
------解决思路----------------------
i <= table.rows.count/100;
------解决思路----------------------
因为在for循环中 i < table.rows.count/100,这里是整除,意思是i小于表里数据行数除以100得到的整数,例如你表中1368条数据,整除100得到13
------解决思路----------------------
1201-1300也能读取出来?
这边i最多是到12吧
for (int i = 1; i <=(table.rows.count - 1)/100 + 1; i++)
{
string comtext = "select * from table where id between " + 100 * (i - 1)+1 + " and " + 100 * i;
..................
}