remplir combo box a partir base donnees
slt j'ai un problem j 'ai cree une methode qui select des codes d'une table (id client) alors le resultat de cette requet je vai la mettre dans un combobox
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| public clients[] selectcin() throws SQLException {
Connection connection = null;
clients[] arr = null;
try {
connection = new dbconnect().getConnection();
ArrayList<clients> list = new ArrayList<clients>();
clients item;
Statement stmnt = connection.createStatement();
ResultSet rs = stmnt.executeQuery("SELECT cin FROM client");
while (rs.next()) {
item = new clients();
item.setCin(rs.getString(1));
list.add(item);
}
arr = new clients[list.size()];
list.toArray(arr);
} finally {
if (connection != null) {
connection.close();
}
return arr;
}
} |
c 'est ma methodes
j espere que vous m aidez