Trop peu de paramètres : 5 attendus
Bonjour,
Je suis perdu dans cette erreur qui s'affiche quand j'exécute mon code.
la méthode appelée :
Code:
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 29 30
|
public class MandeWS{
//....
public TravelInfo rechercheParDateDest(String stDate, String uneDest, String uneClasse){
this.connexion();
ResultSet rs=null;
PreparedStatement pstmt =null;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
java.util.Date date1=new java.util.Date();
TravelInfo travelInfo=new TravelInfo();
String statut="Libre";
try {
date1 = sdf.parse(stDate);
} catch (ParseException e1) {e1.printStackTrace();}
java.sql.Date uneDate = new java.sql.Date(date1.getTime());
try {
pstmt = connect.prepareStatement("SELECT VOL.NumVol, VOL.DateVol, VOL.HeureVol,"+
" VOL.VilleDep, VOL.VilleArr, PLACE.NumPlace, PLACE.ClassePlace, PLACE.Prix"+
" FROM VOL INNER JOIN PLACE ON VOL.NumVol = PLACE.NumVol"+
" WHERE ((VOL.DateVol=?) AND (VOL.VilleArr=?) AND (PLACE.ClassePlace=?) AND (PLACE.Statut=?))");
pstmt.setDate(1, uneDate); // <-- là, c'est une java.sql.Date
pstmt.setString(2,uneDest);
pstmt.setString(3,uneClasse);
pstmt.setString(4, statut);
rs = pstmt.executeQuery(); //ligne N° 88
while(rs.next()){//}
//.....
}
} |
L'application qui appelle :
Code:
1 2 3 4 5 6 7 8 9
|
public class GestionAF {
public static void main(String[] args) {
MandeWS ws=new MandeWS();
TravelInfo travelInfo=ws.rechercheParDateDest("02/07/2009","PARIS","Economique"); // ligne n° 12
//....
} |
L'erreur qui s'affiche
Code:
1 2 3 4 5 6 7 8 9
|
java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Trop peu de paramètres. 5 attendu.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(Unknown Source)
at exemples.mande.MandeWS.rechercheParDateDest(MandeWS.java:88)
at exemples.mande.GestionAF.main(GestionAF.java:12) |