Advertisement
Walkerbo

Bleeding eyes

Sep 10th, 2013
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.63 KB | None | 0 0
  1.     public List <CollectibleMasterBean> getAllCollectibleMasterByCategory(int categoryid) throws SQLException {        
  2.  
  3.         System.out.println(" ++++++++++++++++++++++++++ ");
  4.        
  5.         db = new DataBaseConnection();
  6.         Connection con = db.getConnection();
  7.  
  8.         List <CollectibleMasterBean> listy = new ArrayList<CollectibleMasterBean>();
  9.  
  10.         PreparedStatement PS =
  11.                 con.prepareStatement("SELECT * FROM cabbagedb.collectiblemaster WHERE collectiblemaster.collectiblecategory_id=?");
  12.         PS.setInt(1, categoryid);
  13.         PS.execute();
  14.         ResultSet RS = PS.getResultSet();  
  15.        
  16.         while (RS.next()) {
  17.            
  18.             int TestCMCID = RS.getInt("collectiblemaster.collectiblecategory_id");
  19.            
  20.             if ((TestCMCID <= 0) || (TestCMCID >= 4)) {
  21.                
  22.                 System.out.println("Warning - Warning - Warning - Category ID " + TestCMCID + " does not exist.");
  23.                                
  24.             }
  25.            
  26.             else {
  27.                
  28.             int CMID = RS.getInt("collectiblemaster.collectiblemaster_id");
  29.             int CMIID = RS.getInt("collectiblemaster.item_id");        
  30.             int CMSID = RS.getInt("collectiblemaster.skill_id");
  31.             int CMFID = RS.getInt("collectiblemaster.faculty_id");
  32.             String CMCN = RS.getString("collectiblemaster.name");          
  33.             int CMCID = RS.getInt("collectiblemaster.collectiblecategory_id");
  34.             String CMCD = RS.getString("collectiblemaster.description");
  35.             String CMCIN = RS.getString("collectiblemaster.imagefilename");
  36.  
  37.             CollectibleMasterBean CMB = new CollectibleMasterBean(CMID,CMIID,CMSID,CMFID,CMCN,CMCID,CMCD,CMCIN);
  38.  
  39.             listy.add(CMB);
  40.            
  41.             }
  42.            
  43.         }
  44.        
  45.         System.out.println("   ++++    Here I am - I made it.  Now why wont I work?    ++++    ");
  46.         con.close();
  47.         return listy;
  48.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement