bonjour

J'ai un petit souci avec mon code
je veux afficher les resultat de la requete sql dans jcombobox :

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
23
24
25
26
27
28
 public Vector  getInterne() {
	   Vector v=null;  
	   try{
		   String sql ="SELECT * FROM HOPITAL";  
			ConnectionBD mycon = new ConnectionBD();
			Statement stmt =mycon.getConnectionDb().createStatement();
			ResultSet res=stmt.executeQuery(sql);
			v=new Vector();
			while(res.next()){
			  v.addElement(res.getString(2));
 
			}   
	      }catch (Exception e) {
 
	   }
	return v;
	   }
 
//++++++++++++++++
private JComboBox getJComboBox1() {
		if (jComboBox1 == null) {
			jComboBox1 = new JComboBox();
			jComboBox1.setPreferredSize(new Dimension(145, 20));
 
			jComboBox1.addItem(new DataSource().getInterne());
		}
		return jComboBox1;
	}

merci de votre aide