dimanche 26 avril 2015

WHERE clause in SQLite in a Java program not working

I'm having a very strange problem. I am using SQLite in my java program. I use the jar provided at http://ift.tt/UrdTIP. Executing statements works perfectly except if I use a 'WHERE' clause. For example, the following statement deletes everything:

PreparedStatement stmnt = con.prepareStatement("DELETE FROM pos_payment");
stmnt.executeUpdate();

but the following statement does not do anything even though I am 100% sure that a row with id = 0 exists:

stmnt = local.prepareStatement("DELETE FROM pos_payment WHERE pos_payment_id = ?");
stmnt.setInt(1, value);
stmnt.executeUpdate();

'value' is an integer, and the column 'pos_payment_id' is defined as such:

pos_payment_id int auto_increment PRIMARY KEY

I also tried the 'WHERE' clause in a 'SELECT' statement and it didn't work either. What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire