Exemplo n.º 1
0
 public void updateDokter(Dokter d, String idDokter) throws SQLException {
   try {
     PreparedStatement ps = (PreparedStatement) connection.prepareStatement(updateDokter);
     ps.setString(1, d.getNmDokter());
     ps.setString(2, d.getIdSpesialis());
     ps.setString(3, idDokter);
     ps.executeUpdate();
     ps.close();
     //     JOptionPane.showMessageDialog(null, "Data dokter berhasil diubah!");
   } catch (SQLException se) {
     //    JOptionPane.showMessageDialog(null, se.getMessage(),"Update Dokter
     // Gagal!",JOptionPane.ERROR_MESSAGE);
   }
 }
Exemplo n.º 2
0
 public List getAllDokter() throws SQLException {
   try {
     List list = new ArrayList();
     Statement s = (Statement) connection.createStatement();
     ResultSet rs = s.executeQuery(getAllDokter);
     while (rs.next()) {
       Dokter d = new Dokter();
       d.setIdDokter(rs.getString("id_dokter"));
       d.setNmDokter(rs.getString("nm_dokter"));
       d.setIdSpesialis(rs.getString("nm_spesialis"));
       list.add(d);
     }
     rs.close();
     s.close();
     return list;
   } catch (SQLException se) {
     JOptionPane.showMessageDialog(
         null, se.getMessage(), "Get All dokter gagal!", JOptionPane.ERROR_MESSAGE);
     return null;
   }
 }
Exemplo n.º 3
0
 public List getByIdSpesialis(String idSpesialis) throws SQLException {
   try {
     List list = new ArrayList();
     PreparedStatement ps = (PreparedStatement) connection.prepareStatement(ambilNamaDokter);
     ps.setString(1, idSpesialis);
     ResultSet rs = ps.executeQuery();
     while (rs.next()) {
       Dokter d = new Dokter();
       d.setIdDokter(rs.getString("id_dokter"));
       d.setNmDokter(rs.getString("nm_dokter"));
       list.add(d);
     }
     rs.close();
     ps.close();
     return list;
   } catch (SQLException se) {
     JOptionPane.showMessageDialog(
         null, se.getMessage(), "Get Dokter By Id Spesialis Gagal!", JOptionPane.ERROR_MESSAGE);
     return null;
   }
 }