Create Employee Management System using JAVA - Part 16
Deleting Data from an SQLite (MySql) Database in Netbeans java
Add a button and rename it as 'Delete' right click --> Events --> Action --> actionPerformed
private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {
try{
PreparedStatement pst = conn.prepareStatement("DELETE FROM employeeinfo WHERE employeeid = ?");
pst.setString(1, txt_employeeid.getText());
pst.executeUpdate();
JOptionPane.showMessageDialog(null, "Deleted!");
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
Update_table();
}
See you on next tutorial 17 - .How to update-Edit a data in SQLite (MySql) Database in Netbeans java!
Post a Comment