ADO分页查询

ding1188 2009-03-12 07:07:09
最近自己做练习,想对sql server内的记录用ADO实现分页查询(sql server中有上W条记录,想每次接着上次的位子取1000条)。可是,老是出逻辑上的问题,所有,想写过类似程序的高手提供点代码。谢谢了。
...全文
134 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
oyljerry 2009-03-16
  • 打赏
  • 举报
回复
select top 1000.。 排序等来获取
百事烟 2009-03-16
  • 打赏
  • 举报
回复
sql server2005好象有现成的,听说的,不准
levelmouse 2009-03-16
  • 打赏
  • 举报
回复
如果有排序的话比较简单点。

CString strSQL.Format(_T("select top 1000 * from
(select top %ld * from 表名 order by 排序字段 desc)
order by 排序字段 desc"), i*1000);
i++;
fandh 2009-03-16
  • 打赏
  • 举报
回复
帮顶吧!到网上自己找找资料!
lhsxsh 2009-03-16
  • 打赏
  • 举报
回复
使用个过程,好更好些
jssz103b 2009-03-16
  • 打赏
  • 举报
回复
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)";

4,011

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧