title: how to retrive the data from database and show on JLabel in netbeans
body: <p>I am doing project in Netbeans and want to show the employee details on <code>JLabel</code> while selecting the employee from <code>JComboBox</code>.</p>
  
  <p>I tried... but no effect on the frame.</p>
  
  <pre><code>private void formWindowOpened(java.awt.event.WindowEvent evt) {                                  
     try {                  
  
                     Class.forName("com.mysql.jdbc.Driver");                
                     con = DriverManager.getConnection("jdbc:mysql://localhost:3306/tnpcb","root","");
                     String sql="select curr_no,receive_date from tapal where user_id='"+jComboBox1.getSelectedItem()+"'";
  
  
                     pst=con.prepareStatement(sql);
  
                     rs=pst.executeQuery();
  
                     while(rs.next())
                     {
                         System.out.println("hi22");
                         jLabel1.setText(rs.getString("curr_no"));
                         jLabel1.setText(rs.getString("receive_date"));
                     }
      }
      catch(ClassNotFoundException | SQLException e)
      {
  
      }
   }
  </code></pre>