6 Replies Latest reply: May 14, 2012 10:13 AM by sabre150 RSS

    (need help) my aplication not error but why not working ?

    936150
      i want load data to combobox from database,and this is my code....no error but why not working ?




      private void BoxhobyActionPerformed(java.awt.event.ActionEvent evt) {                                       
      try {
      String dbname="jdbc:odbc:gaji";//nama odbc
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      Connection con=DriverManager.getConnection(dbname,"admin","admin");//user & pasword
      String sql = "select pekerjaan from gaji order by pekerjaan";
      Statement statement = con.createStatement();
      ResultSet rs = statement.executeQuery(sql);
      while (rs.next())
      {
      Boxhoby.addItem(""+rs.getString("pekerjaan"));
      }

      statement.close();

      con.close();
      }catch(Exception x)
      {
      JOptionPane.showMessageDialog(null,"error:"+x,"gagal",JOptionPane.WARNING_MESSAGE);

      }