Question on delete button
Hi, to all i am new to Core java and swings concepts.
I have problem in swings button .
Actually in my application i created one button called DELETE .
i am posted my code help me regarding this topic .
[ int choice = JOptionPane.showConfirmDialog(this,"r u sure
want to delete?","Information",JOptionPane.YES_NO_OPTION);
if(choice==JOptionPane.YES_OPTION)
{
pstmtdel=con.prepareStatement("delete from ICLASS where Sno='"+Sno
+"'");
pstmdel.executeUpdate();
JOptionPane.showMessageDialogthis,"Record
Deleted","Information",JOptionPane.INFORMATION_MESSAGE);
}
else
if(choice==JOptionPane.NO_OPTION)
{
JOptionPane.showMessageDialog(this,"Record Not
Deleted","Information",JOptionPane.INFORMATION_MESSAGE);
}
pstmtdel.executeUpdate();
Now my problem is when i pressing button deleting record even though
when i press NO option.
Now requirement is when i press yes option it's have to delete the
record or if i press no option don't delete record .
Help me Regarding this topic
Thanks in advance