Dear All,
What this is bugs of Java or me not to understand java programming, this my piece code :String kode = txtKode.getText(); String nama = inputNama.getText(); String keterangan = inputKeterangan.getText(); try { Connection c = KoneksiMySql.getKoneksi(); String sql = "UPDATE UNIT SET NAMA=?, KETERANGAN=?, WKT_INPUT=now() WHERE KODE=?"; PreparedStatement p = c.prepareStatement(sql); p.setString(1, nama); p.setString(2, keterangan); p.setString(3, kode); p.executeUpdate(); p.close(); JOptionPane.showMessageDialog(null, "Data Berubah", "Pemberitahuan", JOptionPane.INFORMATION_MESSAGE); } catch(SQLException e) { System.out.println("Error : " + e); JOptionPane.showMessageDialog(null, "Proses Rubah Unit Gagal", "Pesan Error", JOptionPane.ERROR_MESSAGE); }finally { inputNama.setText(null); inputKeterangan.setText(null); btnTambah.setEnable(true); btnHapus.setEnabled(false); btnRubah.setEnabled(false); inputNama.requestFocus(); }
JOptionPane is Show and no error appears but data in database does not change, and code in block finally not executed.
i'm use jInternalFrame, first run Only 'Add Button, Search Button' enable and other button are disable, then when 'Search Button' is clicked and open other jInternalFrame and get data form database, 'Add button' Disable and 'Delete Button, Change Button' are Enable. that my piece code on Change Button ActionPerformed.
Please it's support.
Thanks,
Best & Regrads.