I am writing an Android app that needs to execute an UPDATE query on a SQLite database, but for some reason, the query is not having any effect when I run it.
Here's the function that is supposed to execute the query.
public void query()
{
try
{
cursor = this.db.rawQuery("UPDATE data SET saved=1 WHERE number=1", null);
}
catch(SQLiteException e)
{
System.out.println("Database Query Failed: " + e.getCause().getMessage());
}
}
Although the query does not work, I do not get any output from the catch clause, and adding an additional catch to check for Exception does not output anything either.
What's the problem? How can I get UPDATE queries to work? I have not tried executing an INSERT query, but I will need to do that as well later on. Will I have similar issues with all queries that write to the database?
Aucun commentaire:
Enregistrer un commentaire