public void display(ResultSet rs) { try { boolean recordNumber = rs.next(); if (recordNumber) { payNo = rs.getString(1); pasNo = rs.getString(2); pasName = rs.getString(3); mode = rs.getString(4); dt = rs.getString(5); amount = rs.getString(6); rev = rs.getString(7); text1.setText(payNo); combo1.setSelectedItem(pasNo); combo2.setSelectedItem(pasName); combo4.setSelectedItem(mode); p_date.setText(dt); combo8.setSelectedItem(amount); combo3.setSelectedItem(rev); } else { JOptionPane.showMessageDialog( null, "Record Not found", "ERROR", JOptionPane.DEFAULT_OPTION); } } catch (SQLException sqlex) { sqlex.printStackTrace(); } }
private void generator() { try { ResultSet rst = DBConnection.getDBConnection() .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE) .executeQuery("SELECT Payment_No FROM Payment"); text1.setText("1000"); while (rst.next()) { String s; int number = rst.getInt(1); number = number + 1; s = "" + number; text1.setText(s); int x; } } catch (Exception n) { n.printStackTrace(); } }