hi,

you have to use setTransactionSuccessful() as in

int nRows = 0;
mDb.beginTransaction();
try {
  nRows = mDb.delete("mytable", KEY_ITEM + "=" + rowId,null);
  mDb.setTransactionSuccessful(); // implies commit at endTransaction
} catch( SQLException anyDbError }
  // error logging ...
} finally {
  mDb.endTransaction();
}
return nRows > 0;


worx for me
marcus



________________________________
Von: Jack C. Holt <[EMAIL PROTECTED]>
An: Android Developers <android-developers@googlegroups.com>
Gesendet: Donnerstag, den 4. Dezember 2008, 19:03:19 Uhr
Betreff: [android-developers] Re: Cannot delete rows from sqlite database


See
http://code.google.com/android/reference/android/database/sqlite/SQLiteDatabase.html#beginTransaction()

On Nov 17, 3:28 pm, techvd <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm having a strange issue deleting rows from a sqlite database.
> Here's the code snippet:
>
>         mDb.beginTransaction();
>         int nRows = mDb..delete("mytable", KEY_ITEM + "=" + rowId,
> null);
>         mDb.endTransaction();
>         return nRows > 0;
>
> The database is opened for write. The code above executes perfectly;
> it even returns the number of rows deleted. However, the rows are
> still in the table (even after I exit the app restart, etc.). Am I
> missing anything here. The rest of the code is boilerplate and I can
> read the data from the tables fine.
>
> Thanks!


      
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to