当前位置:网站首页>Paging SQL
Paging SQL
2022-04-23 16:53:00 【Tassel 1990】
Paginated SQL, This method is requested once
public static StringBuilder SqlPageSql(string strSql, string orderField, bool isAsc, int pageSize, int pageIndex)
{
StringBuilder stringBuilder = new StringBuilder();
if (pageIndex <= 0)
pageIndex = 1;
string str = string.Empty;
if (string.IsNullOrEmpty(orderField) == false)
{
if (orderField.ToUpper().IndexOf("ASC") + orderField.ToUpper().IndexOf("DESC") > 0)
str = " order by " + orderField;
else
str = " order by " + orderField + " " + (isAsc ? "asc" : "desc");
}
else
str = "order by (select 0)";
stringBuilder.Append("select * From (select row_number() Over (" + str + ")");
stringBuilder.Append(string.Concat(new object[] { " as rowNum,count(1) over() as totalRecord, * from (", strSql, ") T ) as N where rowNum > ", ((pageIndex - 1) * pageSize), " and rowNum <= ", (pageIndex * pageSize) }));
return stringBuilder;
}
版权声明
本文为[Tassel 1990]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231359253968.html
边栏推荐
- Set the color change of interlaced lines in cells in the sail software and the font becomes larger and red when the number is greater than 100
- Kunteng full duplex digital wireless transceiver chip kt1605 / kt1606 / kt1607 / kt1608 is suitable for interphone scheme
- 05 Lua control structure
- Gartner publie une étude sur les nouvelles technologies: un aperçu du métacosme
- loggie 源码分析 source file 模块主干分析
- 5分钟NLP:Text-To-Text Transfer Transformer (T5)统一的文本到文本任务模型
- DanceNN:字节自研千亿级规模文件元数据存储系统概述
- Copy constructor shallow copy and deep copy
- LVM与磁盘配额
- Execution plan calculation for different time types
猜你喜欢
Rtklib 2.4.3 source code Notes
文件操作详解(2)
Nodejs installation and environment configuration
LVM and disk quota
网络安全之渗透靶场实战详解
On the security of key passing and digital signature
Detailed explanation of Niuke - Gloves
VLAN高级技术,VLAN聚合,超级Super VLAN ,Sub VLAN
Xinwangda: HEV and Bev super fast charging fist products are shipped on a large scale
Dancenn: overview of byte self-developed 100 billion scale file metadata storage system
随机推荐
Nodejs installation and environment configuration
VLAN高级技术,VLAN聚合,超级Super VLAN ,Sub VLAN
英语 | Day15、16 x 句句真研每日一句(从句断开、修饰)
Creation of RAID disk array and RAID5
Zhongang Mining: Fluorite Flotation Process
Talk about browser cache control
博士申请 | 厦门大学信息学院郭诗辉老师团队招收全奖博士/博后/实习生
计算饼状图百分比
阿里研发三面,面试官一套组合拳让我当场懵逼
Bytevcharts visual chart library, I have everything you want
Use case execution of robot framework
PyTorch:train模式与eval模式的那些坑
文件系统读写性能测试实战
LVM与磁盘配额
English | day15, 16 x sentence true research daily sentence (clause disconnection, modification)
Paging the list collection
Dancenn: overview of byte self-developed 100 billion scale file metadata storage system
About stream flow, write it down briefly------
Detailed explanation of file operation (2)
JMeter installation tutorial and solutions to the problems I encountered