Thursday 15 May 2014

Android SQLite Update stops working after calling it two times -


I have problems updating the rows in the SQLite database in my Android application This works only successfully, if I give it But when I try to do it for the third time, it does not update the same line anymore.

Logcat does not show any exceptions. db.update () returns '1' .

I have searched for stack overflow and similar issues on the Web people advice] db.close (); To delete database-assistant from , because I call it multiple times or db.update db.rawQuery () Or db.execSQL () instead of the method.

I also tested my query in the SQLite client, and it works as it is supposed to be.

Here is the code for Simple Database-Assistant Method:

  Public Entry Event Event Document (Event Event) {ContentValues ​​Argos = New Content Value (); Args.put ("full", event.getCompleted ()); Return db.update ("Event", Args, "ID" + "= '" + event.getId () + "'", blank); }   

Should I know when updating a database entry several times in a row?

How does your content provider update and the URI match look?

There is a URI for each table / view for a line in specific content providers where _id is passed as a where and uses a URR for multiple rows, which is where And where are they called

Besides it seems that you update with an ID Android actually wants an ID column named "_id", although I do not think that your problem is currently, take Following it really depends on the URI which is using it. The content provider is usually coded with _id and select based on the column _id based on a line. This is the reason why I want to see the content provider. You choose yourself by ID, it does not seem normal, although it can be completed, but not ideal. Usually where 'colunm name =?' Something else like next parameter where_arguments '?' There is a value string containing string to replace.

Hope it helps.

No comments:

Post a Comment