Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @FXML
- private void DeleteButtonAction(ActionEvent event) throws IOException {
- //alterar conection!
- String myDriver = "org.gjt.mm.mysql.Driver";
- String myUrl = "jdbc:mysql://localhost/test";
- Class.forName(myDriver);
- Connection conn = DriverManager.getConnection(myUrl, "root", "");
- //alterar table name
- String SQL = "DELETE FROM department WHERE dept_no = ? ";
- PreparedStatement pstmt = null;
- // get a connection and then in your try catch for executing your delete...
- pstmt = con.prepareStatement(SQL);
- pstmt.setString(1, Integer.parseInt(textfield.getText()));
- pstmt.executeUpdate();
- conn.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement