problem d' affichage le resultat de la requete dans jcombox
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 26 27 28 29 30
| private JComboBox getJComboBox() {
if (jComboBox == null) {
jComboBox = new JComboBox();
jComboBox.setPreferredSize(new Dimension(145, 23));
jComboBox.addItem(new DataSource().getInterne());
}
return jComboBox;
}
public Vector getInterne() {
Vector v=null;
try{
String sql ="SELECT APPELATION FROM HOPITAL";
ConnectionBD mycon = new ConnectionBD();
Statement stmt =mycon.getConnectionDb().createStatement();
ResultSet res=stmt.executeQuery(sql);
ResultSetMetaData rsmdta =res.getMetaData();
while(res.next()){
for(int i=0; i<=rsmdta.getColumnCount(); i++){
v.addElement( res.getString(2));
}
}
}catch (Exception e) {
}
return v;
} |
merci pour votre aide