0
我使用此代碼從數據庫獲取值,但只能獲得一條記錄,但我想將所有記錄放入組合框。javafx 2.1 combobox
我的代碼是:
try {
stm = db.con.createStatement();
rs = stm.executeQuery("select code from accounts");
while (rs.next()) {
for (int i = 1; i <= 5; i++) {
ol = rs.getObject(i);
}
}
} catch (SQLException sqlException) {
}
ObservableList<Object> options = FXCollections.observableArrayList(ol);
final ComboBox code = new ComboBox();
code.getItems().addAll(options);