208893
Messages postés55Date d'inscriptionmercredi 14 avril 2010StatutMembreDernière intervention21 décembre 2010
-
3 août 2010 à 10:58
cs_Julien39
Messages postés6414Date d'inscriptionmardi 8 mars 2005StatutModérateurDernière intervention29 juillet 2020
-
4 août 2010 à 08:01
slt;
j'ai un problème
j'écrit cet requette et il ne s'exécute pas
**********************************************************************
tf1.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
if( e.getKeyCode() == KeyEvent.VK_ENTER ){
String value = tf1.getText();
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";
String db = "eracontacttt";
String driver = "com.mysql.jdbc.Driver";
String user = "root";
String pass = "";
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db, user, pass);
PreparedStatement st=con.prepareStatement("select (select mat from personnels where mat=?) && " +
"(select((SELECT count(distinct sujet)*100 from plan_for )/(SELECT count(Sujet) FROM plan_for where eval=''))&& " +
"(SELECT mat_ouv,nom,prenom, sum (duree) FROM plan_for GROUP BY mat_ouv)&& " +
"(select mat,nom,prenom,avg(note_a) from saisie group by mat)&&" +
"(select ((SELECT count(distinct mat_ouv)*100 from plan_for)/(SELECT count(mat) from personnels)))&& " +
"(select avg(note) as name'note moyenne' from personnels group by mat)&& " +
"(select((SELECT count(distinct formation_effect) from saisie)/(SELECT count(distinct sujet) FROM plan_for))))" );
st.setString(1,value);
ResultSet res=st.executeQuery();
res.next();
tf1.setText(Integer.toString(res.getInt(1)));
tf2.setText(Integer.toString(res.getInt(2)));
tf3.setText(Integer.toString(res.getInt(3)));
tf4.setText(Integer.toString(res.getInt(4)));
tf5.setText(Integer.toString(res.getInt(5)));
tf6.setText(Integer.toString(res.getInt(6)));
tf7.setText(Integer.toString(res.getInt(7)));
con.close();
}
catch(Exception ee)
{
JOptionPane.showMessageDialog(p1,"Ce matricule n'existe pas");
}
} }
});
**********************************************************************
:comment faire pour exécuetr le résultat de ces requettes en même temps?
merci
A voir également:
Concaténétion des requettes sql dans une application java
cs_Julien39
Messages postés6414Date d'inscriptionmardi 8 mars 2005StatutModérateurDernière intervention29 juillet 2020371 4 août 2010 à 07:59
Ce que tu essaye de faire est impossible, tu ne peux envoyer qu'une seule requete à la fois, et le symbole && n'existe pas en SQL, à la limite UNION, mais ce n'est pas ce qu'il te faut.