Page 225 - 3-1
P. 225

try{
                                      pstmt = conn.prepareStatement(sb.toString());
                                      pstmt.setInt(1, _bno);


                                      rs = pstmt.executeQuery();
                                      rs.next();


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


                                      vo = new ToolVo(bno, toolname, count);
                              } catch(SQLException e){
                                      e.printStackTrace();
                              }


                              return vo;
                      }


                      public void modifyData(ToolVo vo){
                              sb.setLength(0);
                              sb.append("update Tool ");
                              sb.append("set Toolname = ?, ");
                              sb.append(" count = ? ");
                              sb.append(" where bno = ? ");


                              try{
                                      pstmt = conn.prepareStatement(sb.toString());


                                      pstmt.setString(1, vo.getToolname());
                                      pstmt.setInt(2, vo.getCount());
                                      pstmt.setInt(3, vo.getBno());


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







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