Saisie au clavier des entrèes pour enregistrer sur la BD(phpmy)

Fermé
perfu-Mt Messages postés 1 Date d'inscription lundi 21 avril 2014 Statut Membre Dernière intervention 21 avril 2014 - Modifié par Chris 94 le 21/04/2014 à 02:49
Chris 94 Messages postés 50978 Date d'inscription mardi 8 janvier 2008 Statut Modérateur Dernière intervention 17 février 2023 - 21 avril 2014 à 02:38
j'ai utilise cet raquette pour insérer id_etudiant,id_module, NoteTD , NoteTP , NoteExaman , MoyMd au clavier java(eclipse)avec
String id_etudiant,id_module;
float NoteTD,NoteTP,NoteExaman,MoyMd;

et calculer (MoyMdNoteTD+NoteTP+NoteExaman)/3)
ça le code:et ça marche pas :(
c'est vous plaît aide moi

try {
Class.forName("com.mysql.jdbc.Driver");
Connection cnx= DriverManager.getConnection("jdbc:mysql://localhost/db","root","");

MoyMd=((NoteTD+NoteTP+NoteExaman)/3);
System.out.println(MoyMd);
Statement st=cnx.createStatement();
st.executeUpdate("insert into note values('"+id_etudiant+"','"+id_module+"','"+NoteTD+"','"+NoteTP+"','"+NoteExaman+"','"+MoyMd+"' )");

System.out.println("bien ajouter");

}catch(ClassNotFoundException e){
System.out.print("Erreur Driver");
}catch(SQLException e){
System.out.print("Erreur Database");
}


}catch(IOException e){
//System.out.println("err");
}
A voir également:

1 réponse

Chris 94 Messages postés 50978 Date d'inscription mardi 8 janvier 2008 Statut Modérateur Dernière intervention 17 février 2023 7 333
21 avril 2014 à 02:38
0