// Uye güncelleme public void updateUye(Uyeler uye, String param) { Connection connection = null; PreparedStatement preparedStatement = null; String updateString = "UPDATE `uyeler` SET `tc`=?, `ad`=?, `soyad`=?, `meslek`=?,`adres`=?,`telefon`=?,`mail`=?,`kullaniciadi`=?,`sifre`=? WHERE `tc`=?"; try { connection = ConnectionConfiguration.getConnection(); preparedStatement = connection.prepareStatement(updateString); preparedStatement.setString(1, uye.getTc()); preparedStatement.setString(2, uye.getAd()); preparedStatement.setString(3, uye.getSoyad()); preparedStatement.setString(4, uye.getMeslek()); preparedStatement.setString(5, uye.getAdres()); preparedStatement.setString(6, uye.getTelefon()); preparedStatement.setString(7, uye.getMail()); preparedStatement.setString(8, uye.getKullaniciadi()); preparedStatement.setString(9, uye.getSifre()); preparedStatement.setString(10, param); preparedStatement.executeUpdate(); JOptionPane.showMessageDialog(null, "Successful UPDATE"); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage()); } finally { kapatici(connection, preparedStatement, null); } }
// Uye Kayıt public void insertUye(Uyeler uye) { Connection connection = null; PreparedStatement preparedStatement = null; String query = "INSERT INTO uyeler (`tc`, `ad`, `soyad`, `meslek`,`adres`,`telefon`,`mail`,`kullaniciadi`,`sifre`) VALUES (?,?,?,?,?,?,?,?,?)"; try { connection = ConnectionConfiguration.getConnection(); preparedStatement = connection.prepareStatement(query); preparedStatement.setString(1, uye.getTc()); preparedStatement.setString(2, uye.getAd()); preparedStatement.setString(3, uye.getSoyad()); preparedStatement.setString(4, uye.getMeslek()); preparedStatement.setString(5, uye.getAdres()); preparedStatement.setString(6, uye.getTelefon()); preparedStatement.setString(7, uye.getMail()); preparedStatement.setString(8, uye.getKullaniciadi()); preparedStatement.setString(9, uye.getSifre()); preparedStatement.executeUpdate(); JOptionPane.showMessageDialog(null, "Successful INSERT INTO"); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Kayıtta hata oluştu \n" + e.getMessage()); } finally { kapatici(connection, preparedStatement, null); } }