偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

DB2分頁的實(shí)現(xiàn)

數(shù)據(jù)庫
DB2分頁的方法是學(xué)習(xí)DB2數(shù)據(jù)庫過程中必經(jīng)的一步,下面就為您列舉DB2分頁的腳本,供您參考學(xué)習(xí),希望對(duì)您有所幫助。

下文為您介紹DB2分頁的腳本,供您參考學(xué)習(xí),如果您對(duì)DB2分頁方面感興趣的話,不妨一看,相信對(duì)您學(xué)習(xí)DB2分頁會(huì)有所啟迪。

  1. String sqlcount="select count(*) from stu.book "+condition;  
  2.     System.out.println(sqlcount);  
  3.       
  4.     int curPage; //當(dāng)前需要顯示的頁碼  
  5.     int totalPages;   //總頁數(shù)  
  6.     int pageRecord=10; //每頁要顯示的記錄條數(shù)  
  7.     int totalRecords; //滿足條件的總共的記錄條數(shù)  
  8.     if(CPage!=null ){  
  9.      curPage =Integer.parseInt(CPage);  
  10.      if(curPage<1){  
  11.       curPage=1;  
  12.      }  
  13.     }else{  
  14.      curPage=1;  
  15.     }  
  16.     Connection con=Dao.getConn();   //獲取數(shù)據(jù)庫連接  
  17.     try {  
  18.     ps=con.prepareStatement(sqlcount);  
  19.     rs=ps.executeQuery();  
  20.     if(rs.next()){  
  21.      totalRecords=rs.getInt(1);   
  22.      if(totalRecords%pageRecord==0)   
  23.       totalPages=totalRecords/pageRecord;//當(dāng)每頁顯示的記錄條數(shù)能被總記錄條數(shù)整除時(shí) 總頁數(shù)為總記錄條數(shù)除以每頁顯示的記錄條數(shù)  
  24.             else   
  25.           totalPages=totalRecords/pageRecord+1;//當(dāng)每頁顯示的記錄條數(shù)不能被總記錄條數(shù)整除時(shí) 總頁數(shù)為總記錄條數(shù)除以每頁顯示的記錄條數(shù)的商再加1  
  26.      String sql;  
  27.      if(curPage==1){  
  28.       sql="select * from stu.book "+condition+" FETCH FIRST   "+ pageRecord+" ROWS ONLY";  
  29.        
  30.      }else{  
  31.      sql="select * from stu.book "+condition+" and booknum not in ( select booknum from stu.book "+condition+" FETCH FIRST "+(curPage-1)*pageRecord+" ROWS ONLY )"+" FETCH FIRST   "+ pageRecord+" ROWS ONLY";  
  32.      }  
  33.      System.out.println(sql);  
  34.      ps=con.prepareStatement(sql);  
  35.      rs=ps.executeQuery();  
  36.      while(rs.next()){  
  37.       Book b=new Book();  
  38.       b.setBooknum(rs.getString(1));  
  39.       b.setBookname(rs.getString(2));  
  40.       b.setBookindate(rs.getString(3));  
  41.       b.setBorrower(rs.getString(4));  
  42.       b.setLenddate(rs.getString(5));  
  43.       b.setRemark(rs.getString(6));  
  44.       al.add(b);  
  45.        
  46.      }  
  47.           
  48.       
  49.     }else{  
  50.      return al;  
  51.     }  
  52.    } catch (SQLException e1) {  
  53.      
  54.     e1.printStackTrace();  
  55.    }  
  56.      return al;  

以上就是DB2分頁的實(shí)現(xiàn)方法。

 

 

【編輯推薦】

DB2游標(biāo)及其使用

DB2表空間的管理方式

DB2數(shù)據(jù)庫權(quán)限介紹

三種DB2表靜默狀態(tài)

DB2數(shù)據(jù)庫卸載的問題診斷

責(zé)任編輯:段燃 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-11-02 10:46:14

DB2分頁查詢

2010-11-01 17:02:52

DB2頁大小

2010-11-01 11:45:06

DB2管理頁大小

2012-04-25 10:14:40

JavaStruts

2010-09-30 15:52:55

DB2循環(huán)查詢

2010-11-03 14:52:26

DB2列轉(zhuǎn)行

2009-08-25 17:20:57

C#實(shí)現(xiàn)OLE DB的

2010-11-02 15:56:42

DB2添加驗(yàn)證約束

2010-11-02 10:16:22

DB2分區(qū)數(shù)據(jù)庫備份

2009-06-08 16:44:00

2010-11-02 11:08:11

DB2循環(huán)查詢

2010-11-03 14:10:23

DB2在線備份

2010-09-06 14:08:00

DB2管理頁大小

2010-09-01 09:51:03

DB2頁大小

2010-11-03 16:32:10

DB2創(chuàng)建數(shù)據(jù)庫

2015-10-23 16:40:21

DB2刪除數(shù)據(jù)

2010-11-03 13:50:49

DB2刪除重復(fù)數(shù)據(jù)

2010-11-03 10:26:22

DB2存儲(chǔ)過程

2010-11-01 15:53:41

DB2代碼頁設(shè)置

2010-08-26 11:37:38

DB2命令
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)