j'ai une table étudiant:
id_etudiant, nom, prénom, date_nais,code_filière
table filière:
code_filière, libelé_filière, nbr_années
comment insérer la clé primaire code_filiere dans la table étudiant suivant le choix de la filière dans un combobox?
j'ai essayé ça mais ça n'a rien donné:
merci
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 public String getFiliere() throws Exception{ try{ String query = "SELECT code_filiere FROM filiere WHERE libele_filiere=?"; stat = cnx.prepareStatement(query); stat.setString(1, (String) cmbFil.getSelectedItem()); rslt = stat.executeQuery(); stat.close(); }catch(Exception ex){ ex.printStackTrace(); } return rslt.getString(1); }
Partager