DataGrid连接Access的快速分页法(3)——SQL语句的选
来源:互联网 发布:申威处理器 知乎 编辑:程序博客网 时间:2024/06/03 19:02
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
DataGrid连接Access的快速分页法(3)——SQL语句的选用(降序)
三、降序
(1)@PageIndex <= @FirstIndexSELECT TOP @PageSize @QueryFields FROM @TableName WHERE @ConditionORDER BY @PrimaryKey DESC (2)@FirstIndex < @PageIndex <= @MiddleIndex SELECT TOP @PageSize @QueryFields FROM @TableName WHERE @PrimaryKey < ( SELECT MIN(@PrimaryKey) FROM ( SELECT TOP @PageSize*@PageIndex @PrimaryKey FROM @TableName WHERE @Condition ORDER BY @PrimaryKey DESC ) TableA ) WHERE @Condition ORDER BY @PrimaryKey DESC (3)@MiddleIndex < @PageIndex < @LastIndex SELECT * FROM ( SELECT TOP @PageSize @QueryFields FROM @TableName WHERE @PrimaryKey > ( SELECT MAX(@PrimaryKey) FROM ( SELECT TOP (@RecordCount-@PageSize*(@PageIndex+1)) @PrimaryKey FROM @TableName WHERE @Condition -- ORDER BY @PrimaryKey ASC ) TableA ) WHERE @Condition -- ORDER BY @PrimaryKey ASC ) TableB ORDER BY @PrimaryKey DESC (4)@PageIndex >= @LastIndex SELECT * FROM ( SELECT TOP (@RecordCount-@PageSize*@LastIndex) @QueryFields FROM @TableName WHERE @Condition ORDER BY @PrimaryKey ASC) TableA ORDER BY @PrimaryKey DESC四、总结
通过上面的讨论,相信大家应该看到了该分页方法的优势所在。在下一篇中,我将给大家一个动态生成上面 SQL 语句的类。 作者:黎波<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script><script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- DataGrid连接Access的快速分页法(3)——SQL语句的选
- DataGrid连接Access的快速分页法(4)——动态生成SQL语句
- DataGrid连接Access的快速分页法(4)——动态生成SQL语句
- DataGrid连接Access的快速分页法(3)——SQL语句的选用(降序)
- DataGrid连接Access的快速分页法(3)——SQL语句的选用(降序)
- DataGrid连接Access的快速分页法——动态生成SQL语句
- DataGrid连接Access的快速分页法(2)——SQL语句的选用(升序)
- DataGrid连接Access的快速分页法(2)——SQL语句的选用(升序与降序)
- 转载]DataGrid连接Access的快速分页法(2)——SQL语句的选用(升序)
- DataGrid连接Access的快速分页法(2)——SQL语句的选用(升序)
- DataGrid连接Access的快速分页法(5)——实现快速分页
- DataGrid连接Access的快速分页法(5)——实现快速分页
- DataGrid连接Access的快速分页法(1)——需求与现状
- DataGrid连接Access的快速分页法(1)——需求与现状
- DataGrid连接Access的快速分页法(1)——需求与现状
- DataGrid连接Access的快速分页法(1)——需求与现状
- DataGrid基于Access的快速分页法
- DataGrid基于Access的快速分页法
- 8.5.12 匀速位移动画
- C# 2.0 Specification(迭代器)(一)
- C# 2.0 Specification(迭代器)(二)
- 用Socket类构建网页下载器
- jsp操作数据库关键类
- DataGrid连接Access的快速分页法(3)——SQL语句的选
- 如何在.NET中实现事务(2)
- ASP.NET验证控件祥解 -ASP.NET-NET专区-IT知道网(http://www.itwis.com)
- C#学习笔记之五(ADO.net)
- WSDL(Web服务描述语言)详细解析
- C#学习笔记之七(network I/O, Asynchonouse network
- 实例看继承与多态
- Asp.net+Xml开发网络硬盘
- 串行化XML(一)