private void LoadAccounts() { ObservableList<DropdownData> accountItems = FXCollections.observableArrayList(); ResultSet rs = main.DM.Execute("SELECT * FROM bank_account ORDER BY title"); try { rs.beforeFirst(); while (rs.next()) { accountItems.add(new DropdownData(rs.getString("id"), rs.getString("title"))); } } catch (SQLException ex) { Logger.getLogger(FrontendController.class.getName()).log(Level.SEVERE, null, ex); } accounts.setItems(accountItems); }
/** @param selectedAccount */ private void LoadProjects(DropdownData selectedAccount) { ObservableList<DropdownData> projectItems = FXCollections.observableArrayList(); ResultSet rs = main.DM.Execute( "SELECT * FROM bank_project WHERE accountID='" + selectedAccount.value + "' ORDER BY name"); try { rs.beforeFirst(); while (rs.next()) { projectItems.add(new DropdownData(rs.getString("id"), rs.getString("name"))); } } catch (SQLException ex) { Logger.getLogger(FrontendController.class.getName()).log(Level.SEVERE, null, ex); } projects.setItems(projectItems); }