salut a tous!
je travail avec jbuilder et lors de l'execution d'une méthode qui est la suivante :
public int calcul_FAC_COTS(Utilisateur u, int Y)//juste
{
try {
String req2="Select SALAIREBIB from valeurestimation,domaine,organisation where (domaine.IDDOM='"+this.get_IDDOM()+"' AND domaine.IDORG=organisation.IDORG AND organisation.IDORG=valeurestimation.IDORG) " ; // probleme : pour quelle ID estimation
ResultSet res2=u.get_Connexion().consulter_Table(req2);
boolean res2next= res2.next();
Paybib=res2.getDouble("SALAIREBIB");
String SQLNRC="Select NRC,REASS from cots,cotsdom where (cotsdom.IDDOM='"+this.get_IDDOM()+"' AND cotsdom.IDCOTS=cots.IDCOTS AND cots.SD_COTS='"+SD+"')";
ResultSet resSQLNRC=u.get_Connexion().consulter_Table(SQLNRC);
boolean resSQLNRCnext= resSQLNRC.next();
while(resSQLNRCnext==true)
{Somme_NRC=Somme_NRC+(resSQLNRC.getDouble("NRC")+resSQLNRC.getDouble("REASS"));
resSQLNRCnext= resSQLNRC.next();}
String reqnbcomp="select count(IDCOTS) from cots ";
ResultSet resnbcomp=u.get_Connexion().consulter_Table(reqnbcomp);
boolean resnbcompnext=resnbcomp.next();
nbcots =resnbcomp.getInt("count(IDCOTS)");
SDY= SD+Y;
i=SD+1;
while(i<=SDY)
String SQLCots2="Select CCOTS from cots,cotsdom where (cotsdom.IDDOM='"+this.get_IDDOM()+"' AND cotsdom.IDCOTS=cots.IDCOTS AND cots.SD_COTS='"+i+"')";
ResultSet resSQLCots2=u.get_Connexion().consulter_Table(SQLCots2);
boolean resSQLCots2next= resSQLCots2.next();
while(resSQLCots2next==true)
{Somme_ccots=Somme_ccots + resSQLCots2.getDouble("CCOTS");
resSQLCots2next= resSQLCots2.next();}
String reqn= "select VALEUR_BIB from cout_op_bib_cots,cotsdom where (cout_op_bib_cots.IDCOTS=cotsdom.IDCOTS AND cotsdom.IDDOM='"+this.get_IDDOM()+"' AND ANNEE_BIB='"+i+"')";
ResultSet resn=u.get_Connexion().consulter_Table(reqn);
boolean reqnext=resn.next();
opbib=resn.getDouble("VALEUR_BIB");
OC= opbib/nbcots;
CE = Somme_ccots + Somme_NRC + (OC*Paybib);
String InsertCE="Insert into ce_dom (ID_EST_DOM,ID_CE_DOM,IDDOM,TYPE_EST_DOM,VALEUR_CE_DOM,ANNEE_CE_DOM) values ('"+cle+"','','"+this.get_IDDOM()+"','"+PLE2+"','"+CE+",'"+i+"')";
int resInserCE=u.get_Connexion().modifier_Table(InsertCE);
i=i+1;
}
}
catch(SQLException e)
{
System.err.println("Probleme");
}
return(cle);
}
j'ai rencontré cette erreur :
java.sql.SQLException: [MySQL][ODBC 3.51 Driver][mysqld-4.0.15-max-debug]Duplicata du champ '4-0' pour la clef 1
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
at pfe.Connexion.modifier_Table(Connexion.java:47)
at pfe.Domaines.calcul_FAC_COTS(Domaines.java:1089)
at pfe.Domaines.main(Domaines.java:1409)
java.sql.SQLException: [MySQL][ODBC 3.51 Driver][mysqld-4.0.15-max-debug]Erreur de syntaxe près de '2003')' à la ligne 1
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
at pfe.Connexion.modifier_Table(Connexion.java:47)
at pfe.Domaines.calcul_FAC_COTS(Domaines.java:1214)
at pfe.Domaines.main(Domaines.java:1409)
Probleme
aidez moi svp
merci