最近自己做练习,想对sql server内的记录用ADO实现分页查询(sql server中有上W条记录,想每次接着上次的位子取1000条)。可是,老是出逻辑上的问题,所有,想写过类似程序的高手提供点代码。谢谢了。

解决方案 »

  1.   

    page++;
    string sql = "select top 1000 * from  account_info where account not in (select top ";
    long i = 1000*page;;
    char str[256];
    sprintf_s(str,"%ld",i);
    sql += str;
    sql += " account from account_info)";
      

  2.   

    如果有排序的话比较简单点。CString strSQL.Format(_T("select top 1000 * from
                         (select top %ld * from 表名 order by 排序字段 desc)
                          order by 排序字段 desc"), i*1000);
    i++;
      

  3.   

    sql server2005好象有现成的,听说的,不准
      

  4.   

    select top 1000.。 排序等来获取