working with java combobox want to only remove the selected item from M S Access record not whole record
<p>i am working with java applet GUI application and want to do that when i press on delete button only that item which is selected in combobox is deleted from M S Access but my below code deleted whole record from  M S Access..</p>

<pre><code>code i tried is:

 if(e.getSource()==btn_del)
    {
       try
                {


                    Connection con;

                    DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());

                    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

                    con = DriverManager.getConnection("jdbc:odbc:dsnproj","","");

                    Statement s=con.createStatement();

                    String q="select * from trans_dest
                                 where                                    
                                 dest='"+cmb_dest.getSelectedItem()+"'";

                    ResultSet r=s.executeQuery(q);

                    while (r.next()) {


                        r1=r.getString(2);

                        System.out.println(r1);

                        r2=r.getString(3);

                        System.out.println(r2);

                        r3=r.getString(4);
                        System.out.println(r3);

                        r4=r.getString(5);
                        System.out.println(r4);

                        String qryd1,qryd2,qryd3,qryd4;

                        qryd1="DELETE route1 from trans_dest where route1='"+r1+"'";
                        qryd2="DELETE route2 from trans_dest where route2='"+r2+"'";
                        qryd3="DELETE route3 from trans_dest where route3='"+r3+"'";
                        qryd4="DELETE route4 from trans_dest where route4='"+r4+"'";

                       if(r1.equals(cmb_route.getSelectedItem()))

                        {

                            System.out.println("in 1st");
                           int executeUpdate= s.executeUpdate(qryd1);
                           System.out.println(executeUpdate);

                        }

                        else if(r2.equals(cmb_route.getSelectedItem()))

                        {

                            System.out.println("in 2nd");

                            int executeUpdate1 = s.executeUpdate(qryd2);
                            System.out.println(executeUpdate1);
                        }

                        else if(r3.equals(cmb_route.getSelectedItem()))

                        {

                            System.out.println("in 3rd");

                            int executeUpdate2 = s.executeUpdate(qryd3);
                            System.out.println(executeUpdate2);
                        }

                        else if(r4.equals(cmb_route.getSelectedItem()))

                        {

                            System.out.println("in 4th");

                            int executeUpdate3 = s.executeUpdate(qryd4);
                            System.out.println(executeUpdate3);
                        }


                 }




              Frame f=new Frame();

               JOptionPane.showMessageDialog(f, "Deleted product Successfully... ");

              System.out.println("deleted...");
       }
</code></pre>

<p>}</p>

<p>there is no error but removes whole record from my database insted of only on field which i selected...</p>

<p>output is:</p>

<pre><code>apple
banana
grapes
null
in 2nd
1
ResultSet is closed
</code></pre>
