i want the data to be save sucessfully
<p>I have a JFrame name opinion. in this form I have given a error message for each field means whenever I am filling the form and if I put any field empty and than click save button it should display that error message for that perticular empty field is empty. my code is saving the data but when I put any field empty and click on save button it shoowing the error msg that perticular field is empty but when I click on ok button of that error msg box it also saving the data but with that empty field my code is:</p>

<pre><code>    String name= (String)cbNM.getSelectedItem();
    if(name.equals(""))
        JOptionPane.showMessageDialog(null," ENTER THE NAME");

    String socialservice=(String)cbsocial.getSelectedItem();
    if(socialservice.equals(""))
        JOptionPane.showMessageDialog(null," SELECT THE SOCIAL SERVICE");

    String whichservice=tasocial.getText();
    if(whichservice.equals(""))
        JOptionPane.showMessageDialog(null," ENTER SOCIAL SERVICE U LIKE");

    String expectation=taexpectation.getText();
    if(expectation.equals(""))
        JOptionPane.showMessageDialog(null," ENTER UR EXPECTATION FROM WANI SAMAJ");

    String revealinfo=(String)cbreveal.getSelectedItem();
    if(revealinfo.equals(""))
        JOptionPane.showMessageDialog(null,"SELECT UR DECISION ON REVEAL THE INFORMATION");

    String addr=taaddress.getText();
    if(addr.equals(""))
        JOptionPane.showMessageDialog(null," ENTER THE ADDRESS");



    try {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection con=DriverManager.getConnection("jdbc:odbc:wanisamajDB");
        Statement stmt=con.createStatement();
        String qry= "INSERT INTO Opinion(PersonName,LikeSocialService,WhichService,Expectation,RevealInformation,Address) VALUES('"+name+"','"+socialservice+"','"+whichservice+"','"+expectation+"','"+revealinfo+"','"+addr+"')";
        stmt.executeUpdate(qry);
        JOptionPane.showMessageDialog(null,"RECORD IS SAVED SUCCESSFULLY ");
        con.close();

    } catch(SQLException eM) {
        JOptionPane.showMessageDialog(null,"RECORD IS NOT SAVED");
    } catch(Exception et) {
        System.out.println("error:"+et.getMessage());
    }
</code></pre>
