Tom Tom - 1 year ago 100
Android Question

Query error in SQLite

I've tried this code to update all my values in column sync to 0...

How can I solve this issue?

public boolean updatesync()
SQLiteDatabase db=this.getWritableDatabase();

db.rawQuery("update patients set sync = '0'",null);

return true;

This code is not working. I need to change the entire column value of sync to 0. How can I do that? I've found this code as working when searching, but it's not working for me. How can I solve that?

Please help.

Answer Source

Use execSQL() instead of rawQuery().

rawQuery() just compiles the SQL but does not execute it until the returned Cursor is moved. execSQL() both compiles and executes the SQL.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download