当前位置:网站首页>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
边栏推荐
- Detailed explanation of UWA pipeline function | visual configuration automatic test
- Mock test
- Xinwangda: HEV and Bev super fast charging fist products are shipped on a large scale
- 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
- 计组 | 【七 输入/输出系统】知识点与例题
- Detailed explanation of Niuke - Gloves
- ∑GL-透视投影矩阵的推导
- Modify the test case name generated by DDT
- 05 Lua control structure
- Use case labeling mechanism of robot framework
猜你喜欢
STM32__03—初识定时器
Pycham connects to the remote server and realizes remote debugging
Detailed explanation of information abstract, digital signature, digital certificate, symmetric encryption and asymmetric encryption
建站常用软件PhpStudy V8.1图文安装教程(Windows版)超详细
信息摘要、数字签名、数字证书、对称加密与非对称加密详解
File upload and download of robot framework
feign报400处理
Nifi fast installation and file synchronization
[pimf] openharmony paper Club - what is the experience of wandering in ACM survey
Bytevcharts visual chart library, I have everything you want
随机推荐
网络安全之渗透靶场实战详解
◰ GL shader handler encapsulation
Detailed explanation of information abstract, digital signature, digital certificate, symmetric encryption and asymmetric encryption
关于 background-image 渐变gradient()那些事!
PostgreSQL column storage and row storage
计算饼状图百分比
Blue Bridge Cup provincial road 06 -- the second game of the 12th provincial competition
博士申请 | 厦门大学信息学院郭诗辉老师团队招收全奖博士/博后/实习生
Change the password after installing MySQL in Linux
无线鹅颈麦主播麦手持麦无线麦克风方案应当如何选择
人脸识别框架之dlib
Feign report 400 processing
feign报400处理
Deepinv20 installation MariaDB
Solution of garbled code on idea console
PHP高效读大文件处理数据
Getting started with JDBC
Rtklib 2.4.3 source code Notes
文件系统读写性能测试实战
安装及管理程序