<% float sum=0; cb.setEVERYPAGENUM(12); int cou = cb.getMessageCount("select count(*) from gh ");//得到信息总数 String page1=request.getParameter("page"); if(page1==null){ page1="1"; } session.setAttribute("busMessageCount", cou + ""); session.setAttribute("busPage", page1); List pagelist1 = cb.getMessage(Integer.parseInt(page1),"select * from gh order by id desc",14); session.setAttribute("qqq", pagelist1); int pageCount = cb.getPageCount(); //得到页数 session.setAttribute("busPageCount", pageCount + ""); List pagelist3=(ArrayList)session.getAttribute("qqq"); if(!pagelist3.isEmpty()){ for(int i=0;i<pagelist3.size();i++){ List pagelist2 =(ArrayList)pagelist3.get(i); %>
时间: 2023-06-20 13:07:02 浏览: 52
这段代码是一个JSP页面中的Java代码,主要功能是分页查询数据库表gh中的数据,并将查询结果保存在session中。具体实现方式是通过调用cb对象的getMessageCount方法和getMessage方法来获取总记录数和每页记录数,并通过循环遍历查询结果来计算总和。最后将页数和查询结果保存在session中,以便在页面中显示。
相关问题
SELECT @strSql+=' COU.IsDelete=0 AND HR.IsDelete=0 AND TR.IsDelete=0 AND ORD.PayTime<>'1900-01-01 00:00:00.000''
在这段代码中,你需要对单引号进行转义,以便 SQL Server 能够正确地解析字符串中的单引号。
你可以使用两个单引号来代替一个单引号,或者使用反斜杠(\)来转义单引号。
例如,你可以这样修改代码:
```
SELECT @strSql += ' COU.IsDelete=0 AND HR.IsDelete=0 AND TR.IsDelete=0 AND ORD.PayTime <> ''1900-01-01 00:00:00.000'' '
```
在上面的代码中,两个单引号被用来代替一个单引号。这样,SQL Server 就可以正确地解析字符串中的单引号了。
或者,你也可以使用反斜杠来转义单引号,例如:
```
SELECT @strSql += ' COU.IsDelete=0 AND HR.IsDelete=0 AND TR.IsDelete=0 AND ORD.PayTime <> \'1900-01-01 00:00:00.000\' '
```
在上面的代码中,反斜杠被用来转义单引号。这样,SQL Server 也可以正确地解析字符串中的单引号了。
SELECT SUM(ISNULL(COU.CoursePrice, 0)) AS aa FROM hrflagwxsp.dbo.CourseInfo COU WITH(NOLOCK) JOIN dbo.OrderListInfo ORD ON ORD.CourseInfoId=COU.CourseId WHERE COU.IsDelete=0 AND ORD.IsDelete=0 AND ORD.PayTime<>'1900-01-01 00:00:00.000'
这是一个 SQL Server 查询语句,它使用 SUM() 函数在 hrflagwxsp.dbo.CourseInfo 和 dbo.OrderListInfo 表中计算课程价格的总和。查询语句中的 ISNULL() 函数用于将 NULL 值转换为零,以便在计算总和时不会出现 NULL 值。查询语句中的 JOIN 子句用于将 hrflagwxsp.dbo.CourseInfo 表和 dbo.OrderListInfo 表连接起来,以便获取课程信息和订单信息。WHERE 子句用于过滤掉已删除的课程和订单,并且筛选支付时间不等于 '1900-01-01 00:00:00.000' 的订单。最后,查询语句使用 AS 关键字将计算出的总和命名为 aa。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)