Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Yts 95
Added: Jul 26, 2020 3:00 AM
Views: 104
Tags: no tags
  1. ImageIcon icon = new ImageIcon("src\\aquafish\\delete_bin_32px.png");
  2.        
  3.         try
  4.         {
  5.             int yesNo = JOptionPane.showConfirmDialog(null ,"Delete" , "Warning",JOptionPane.YES_NO_OPTION , JOptionPane.INFORMATION_MESSAGE, icon);
  6.  
  7.             if(yesNo == JOptionPane.YES_OPTION){
  8.                 String query = "DELETE FROM tb_buyfish WHERE ai = ?";
  9.                 pst = this.con.prepareStatement(query);
  10.  
  11.                 pst.setString(1,b_ai.getText());
  12.              
  13.  
  14.                 pst.executeUpdate();
  15.                 b_ai.setText("");
  16.                 buyfish_filltable();
  17.                 fish_clearform();
  18.             }
  19.         }
  20.         catch(Exception e)
  21.             {
  22.                 JOptionPane.showMessageDialog(null,"Delete buyfish: " + e.getMessage());
  23.             }