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 24, 2020 1:30 PM
Views: 102
Tags: no tags
  1.  
  2.          try
  3.         {
  4.             DefaultTableModel dtm = (DefaultTableModel) buyfish_tb.getModel();
  5.             int row = buyfish_tb.getSelectedRow();
  6.  
  7.             String getai = buyfish_tb.getValueAt(row , 0).toString();
  8.  
  9.             String query = "SELECT * FROM tb_buyfish WHERE ai = '"+ getai +"'";
  10.             st = this.con.createStatement();
  11.             rs = st.executeQuery(query);
  12.  
  13.             rs.next();
  14.             buyfish_size.setText(rs.getString("size"));
  15.             fish_combo.setName(rs.getString("fishname"));
  16.             cat_combo.setName(rs.getString("color"));
  17.             buyfish_qty.setText(rs.getString("qty"));
  18.             buyfish_price.setText(rs.getString("price"));
  19.             buyfish_totalprice.setText(rs.getString("totalprice"));
  20.             buyfish_date.setDateFormatString(rs.getString("date"));
  21.  
  22.         }
  23.         catch(Exception e){
  24.             {
  25.                 JOptionPane.showMessageDialog(null,"E1: " + e.getMessage());
  26.             }
  27.  
  28.         }