Пример #1
0
  private void btnDeleteActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnDeleteActionPerformed
    try {
      int P =
          JOptionPane.showConfirmDialog(
              null, " Are you sure want to delete ?", "Confirmation", JOptionPane.YES_NO_OPTION);
      if (P == 0) {
        con = Connect.ConnectDB();
        String sql = "delete from Doctor where DoctorID = '" + txtDoctorID.getText() + "'";
        pst = con.prepareStatement(sql);
        pst.execute();
        JOptionPane.showMessageDialog(
            this, "Successfully deleted", "Record", JOptionPane.INFORMATION_MESSAGE);

        Reset();
      }
    } catch (HeadlessException | SQLException ex) {
      JOptionPane.showMessageDialog(this, ex);
    }
  } // GEN-LAST:event_btnDeleteActionPerformed
Пример #2
0
 private void btnNewActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnNewActionPerformed
   Reset();
 } // GEN-LAST:event_btnNewActionPerformed