Академический Документы
Профессиональный Документы
Культура Документы
ActionEvent evt) {
try{
koneksi();
String sql = "insert into t_rumah values ('"+ txttipe.getText()+"', '"
+ txtluastnh.getText() + "' , '" + txtluasbgn.getText() + "','" +
txtharga.getText() +"','" + txtuang.getText() + "')";
cn.executeUpdate(sql);
conn.close();
tampildata();
//bersih();
JOptionPane.showMessageDialog(null,"Data berhasil di simpan");
try{
koneksi();
String sql = "delete from t_rumah " +
"where tipe='" + txttipe.getText() + "'";
cn.executeUpdate(sql);
cn.close();
tampildata();
}catch(Exception e){
JOptionPane.showMessageDialog(null," Gagal dihapus");
System.out.println(e.getMessage());
}
try{
koneksi();
String sql = "update t_rumah " +
"set tipe='" + txttipe.getText() + "' ," +
"uang_muka='" + txtuang.getText() + "' where tipe='"+
txttipe.getText() +"'";
cn.executeUpdate(sql);
conn.close();
tampildata();
//bersih();
JOptionPane.showMessageDialog(null,"Data berhasil di update");