Delete row in Database through java swings.


try
    {
        int id=Integer.parseInt(jTextField12.getText());
         Connection c=new Connection();
            java.sql.Connection con=c.connectit();
            String sql="DELETE FROM stock WHERE id =?";
            PreparedStatement pst=con.prepareStatement(sql);
            pst.setInt(1, id);
            pst.executeUpdate();
            JOptionPane.showMessageDialog(null, "Delete!!");
    }
    catch(Exception e)
    {
        JOptionPane.showMessageDialog(null, e);
    }
    table();
    settext1();

Popular posts from this blog

Simple Sign up design. Android.

Cart page design in android.

Set Date on jDateChooser and retrieve record from database.