Bonjour,
j'ai deux comboBox, je veux que l'insertion du prenom (2éme combo) se fait automatiquement ç-à-d selon ce que j'ai séléctionné dans le premier.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 String sql= "SELECT Nom FROM Client Nom ORDER BY Nom ASC"; statement1 = connection1.prepareStatement(sql); ResultSet rs= statement1.executeQuery(); while(rs.next()) { comboBox_1.addItem(rs.getString("Nom")); } String sql1="SELECT DISTINCT Prenom FROM Client Prenom ORDER BY Prenom ASC"; statement1= connection1.prepareStatement(sql1); //statement1.setString(1,comboBox_1.getSelectedItem().toString() ); ResultSet rs1= statement1.executeQuery(); while(rs1.next()) { comboBox_2.addItem(rs1.getString("Prenom")); }
Partager