private void setamount() { try { ResultSet rst = DBConnection.getDBConnection() .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE) .executeQuery( "SELECT Amount FROM BOOKING where Pass_No='" + combo1.getSelectedItem() + "'"); while (rst.next()) { combo8.addItem(rst.getString(1)); } } catch (Exception n) { n.printStackTrace(); } }
private void setCombo() { try { ResultSet rst = DBConnection.getDBConnection() .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE) .executeQuery( "SELECT Emp.empNo, Emp.Sname, Emp.Fname, Emp.Lname, Emp.Designation FROM Emp WHERE Emp.Designation='Booking Clerk'"); while (rst.next()) { combo3.addItem(rst.getString(3)); } } catch (Exception n) { n.printStackTrace(); } }
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 setcbr() { try { ResultSet rst = DBConnection.getDBConnection() .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE) .executeQuery( "SELECT * FROM Passenger where Booked_status='Booked' and Pay_Status='Not_Paid'"); System.out.println("Hello"); while (rst.next()) { combo1.addItem(rst.getString(1)); combo2.addItem(rst.getString(2)); } } catch (Exception n) { n.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(); } }