コード例 #1
0
 @Override
 public void insert(Bank bank) {
   PreparedStatement pr;
   try {
     pr = con.prepareStatement("insert into tbl_Bank " + "(Name) values (?)");
     pr.setString(1, bank.getName());
     pr.execute();
     pr.close();
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }
コード例 #2
0
 @Override
 public void update(Bank bank) {
   PreparedStatement pr;
   try {
     pr = con.prepareStatement("update tbl_Bank " + "set Name = ? " + "where id = ?");
     pr.setString(1, bank.getName());
     pr.setInt(2, bank.getId());
     pr.execute();
     pr.close();
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }