Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Yts 95
Added: Jul 10, 2020 1:32 PM
Modified: Jul 10, 2020 1:37 PM
Views: 96
Tags: no tags
  1. private void combo_ser()
  2. {
  3.         try{
  4.             DefaultComboBoxModel dcm = (DefaultComboBoxModel)ser.getModel();
  5.             dcm.setSelectedItem("Select Service");
  6.            
  7.             String sql1 = "SELECT service_name FROM service ORDER BY service_name";
  8.              st = this.con.createStatement();
  9.              rs = st.executeQuery(sql1);
  10.              
  11.              
  12.              while(rs.next())
  13.              {
  14.                   ser.addItem(rs.getString("service_name"));
  15.              
  16.              }
  17.         }
  18.         catch(Exception e)
  19.         {
  20.             JOptionPane.showMessageDialog(null,"com add service name: " + e.getMessage());
  21.         }
  22. }