fonction javascript qui marche pas
salut tout le monde
je suis un debutant en javascript, j'ai cette fonction qui affiche un message d'erreur, je ne comprend pas pourkoi
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
|
function Convertir(str){
String temog="";
String tmp="";
int i=0;
while (i<temo.length()){
if (temo.charAt(i)!='-'){tmp=tmp+temo.charAt(i);}
if (tmp.length()==4){
try {
String req = "SELECT NATURE FROM TRAVAUX WHERE CODTRV = '"+tmp+"' ";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(req);
if (rs.next()){
if (temog==""){temog=rs.getString("NATURE");}
else{
temog=temog+" - "+rs.getString("NATURE");}}
//temog=temog+tmp;
tmp="";
}
catch(Exception exc){
exc.printStackTrace();}
}
i++;
}
return tomog;
} |
l'appel est comme suit
Code:
temo=Convertir(temo);
j'espère que vous m'aidez svp
merci