hey guys..
i have used this code to show data from mysql database through JComboBox
DefaultComboBoxModel model=(DefaultComboBoxModel) jComboBox6.getModel(); String sql="SELECT * FROM department"; try { Class.forName("com.mysql.jdbc.Driver"); Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/store","root","root"); Statement stat= con.createStatement(); ResultSet res= stat.executeQuery(sql); while(res.next()) { String name=res.getString("dep_name"); model.addElement(name); } } catch(Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); }
now i want the code to delete selected item from JCombBox from database plz