当前位置:网站首页>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
边栏推荐
- Installation and management procedures
- 无线鹅颈麦主播麦手持麦无线麦克风方案应当如何选择
- Node access to Alipay open platform sandbox to achieve payment function
- Flask如何在内存中缓存数据?
- 织梦DEDECMS安全设置指南
- How vscode compares the similarities and differences between two files
- DDT + Excel for interface test
- oracle 中快速获取表的列名列表
- Use if else to judge in sail software - use the title condition to judge
- Feign report 400 processing
猜你喜欢

Dancenn: overview of byte self-developed 100 billion scale file metadata storage system

Detailed explanation of information abstract, digital signature, digital certificate, symmetric encryption and asymmetric encryption

The new MySQL table has a self increasing ID of 20 bits. The reason is

Ali developed three sides, and the interviewer's set of combined punches made me confused on the spot

The font of the soft cell changes color

Detailed explanation of Niuke - Gloves

English | day15, 16 x sentence true research daily sentence (clause disconnection, modification)

org. apache. parquet. schema. InvalidSchemaException: A group type can not be empty. Parquet does not su

RTKLIB 2.4.3源码笔记

Feign report 400 processing
随机推荐
ACL 2022 | DialogVED:用于对话回复生成的预训练隐变量编码-解码模型
Loggie source code analysis source file module backbone analysis
100 deep learning cases | day 41 - convolutional neural network (CNN): urbansound 8K audio classification (speech recognition)
DDT + Excel for interface test
如何用Redis实现分布式锁?
Dlib of face recognition framework
CentOS MySQL multi instance deployment
Tencent resolves the address according to the IP address
深入了解3D模型相关知识(建模、材质贴图、UV、法线),置换贴图、凹凸贴图与法线贴图的区别
Kunteng full duplex digital wireless transceiver chip kt1605 / kt1606 / kt1607 / kt1608 is suitable for interphone scheme
Production environment——
Detailed explanation of file operation (2)
Use itextpdf to intercept the page to page of PDF document and divide it into pieces
Path environment variable
File system read and write performance test practice
Knowledge points and examples of [seven input / output systems]
Interface document yaml
On the security of key passing and digital signature
Installation and management procedures
Loading order of logback configuration file