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();