public void updateRow(int form_no, String form_name, String question_name, String answer_1, String answer_2, String answer_3, int answer_1_count, int answer_2_count, int answer_3_count) {
String sql = "UPDATE " + DATABASE_TABLE + " SET " + KEY_ANSWER_1_COUNT + " = " + answer_1_count + ", " +KEY_ANSWER_2_COUNT + " = " + answer_2_count + ", " + KEY_ANSWER_3_COUNT + " = " + answer_3_count + " " +
"WHERE " + KEY_FORM_NO + "=" + form_no + " AND " + KEY_QUESTION_NAME + " = ?";
Cursor c = db.rawQuery(sql, new String[]{question_name});
c.close();
}
db is an object of Sqlite. I have used db.update() as well which isn't work either. Im trying to increase counter for key_answers by 1 when using this method, but it doesnt work. It only update once and I cant show it either. Only time I see the update actually placed is when I reopen the application and it doesnt accurate neither since it only updates once where I call update 3-4 more times.
Whats the problem here, how can I resolve this ? Thank you.
Aucun commentaire:
Enregistrer un commentaire