mardi 5 janvier 2016

java.sql.SQLException: Index de colonne non valide

Exception:java.sql.SQLException: Index de colonne non valide
this problem occurs when we work with jdbc and want to know the value of a column that the index is worng for example we do:

ResultSet rs= stm.executeQuery(SQL);
long id=0;
while (rs.next()) {
id=rs.getLong(0);
}

to resolve this exception we must change  id=rs.getLong(0); by  id=rs.getLong(1);  you must be sur  that the index exist.

Aucun commentaire:

Enregistrer un commentaire

CANADA JOB