how to use check box in jtable with the help of sql query to display values in jlabel after button is clicked

35 Views Asked by At

i have try to display the lower value of item qty in jlabel after checkbox selected in jtable which is already populated by sql query and by clicking the jbutton these value will display in jlabel.

i have try to list the selected item for display the lower item qty in jlabel .

private void ButtonbtActionPerformed(java.awt.event.ActionEvent evt) {                                         
        try {
            PreparedStatement ps = DataBase.mycon().prepareStatement("select (sum(`Item Available Qty`)/Qty) as available,"
                    + "`Check` from a where `Part No` is not null and `Check` !='1'" 
                    +"group by `Part No` order by (sum(`Item Available Qty`)/Qty) limit 1");
            ResultSet rs = ps.executeQuery();
            while (rs.next()) {
                String product = rs.getString("available");
                BOMProductsL.setText(product);
            }
            ps.close();
            DataBase.mycon().close();
        } catch (SQLException e) {
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, "Product loading error");
        }
    } 

Expected Output by clicking in button

Expected output

Output i get by clicking in button

output i get

0

There are 0 best solutions below