vendredi 17 avril 2015

No such column: 'id'

I have following code:



...

Connection conn = dbm.getConnection();
Statement statement = conn.createStatement();
ResultSet rsID = statement.executeQuery("SELECT id FROM tbl_seznamML");

int c1;
while (rsID.next()) {
c1 = rsID.getInt("id"); // error
System.out.println(c1);

}

...


And keep getting sqlexception no such column: 'id' But the column id exists and table is correct. Values are in resultset but dunno why i cant get them. What im doing wrong? I'm asking because I use this code exactly in another class and its working without problems but here i cant get anything from resultset. Thanks for help in advance


Aucun commentaire:

Enregistrer un commentaire