Page 224 - 3-1
P. 224

while(rs.next()){
                                              int bno = rs.getInt("bno");
                                              String toolname = rs.getString("Toolname");
                                              int count = rs.getInt("count");


                                              ToolVo vo = new ToolVo(bno, toolname, count);


                                              list.add(vo);
                                      }
                              } catch(Exception e){
                                      e.printStackTrace();
                              }


                              return list;
                      }


                      public void addData(ToolVo vo){
                              sb.setLength(0);
                              sb.append("insert into Tool ");
                              sb.append("values (?, ?, ?) ");


                              try{
                                      pstmt = conn.prepareStatement(sb.toString());
                                      pstmt.setInt(1, vo.getBno());
                                      pstmt.setString(2, vo.getToolname());
                                      pstmt.setInt(3, vo.getCount());


                                      pstmt.executeUpdate();
                              } catch(SQLException e){
                                      e.printStackTrace();
                              }
                      }


                      public ToolVo getData(int _bno){
                              sb.setLength(0);
                              sb.append("select * from Tool ");
                              sb.append("where bno = ? ");


                              ToolVo vo = null;





                                                         - 224 -
   219   220   221   222   223   224   225   226   227   228   229