I use db.execSQL to delete. -- Chris Stewart http://chriswstewart.com
Fantasy Football<http://chriswstewart.com/android-applications/fantasy-football/>- Android app for fantasy football fanatics and MFL owners Social Updater<http://chriswstewart.com/android-applications/social-updater/>- An easy way to send your status blast to multiple social networks On Fri, Aug 13, 2010 at 11:15 AM, Wall-E <bashee...@gmail.com> wrote: > I have written a database adapter to implement database functions like > query(), delete(), update(), insert()....etc. So I have been able to > insert and query just fine but deleting a specific row is not working > at all. I have tested deleting all the rows and that works fine even > though the return value is still 0 or false. I have posted my > delete() method and my table: > > Again, I have confirmed insert and query but not delete and after > sending this post I'm going to try the update to see if that works. > Also, the open() call just does the DBHelper.getWritableDatabase(). > I'm concerned that it is the way my table is set up but I've tried all > the sql statements in a sqlite browser and that table is just fine. > > db.execSQL( "CREATE TABLE " + ECHOLIST_TABLE + " (" + > "[PHONENUMBER_ID] NVARCHAR(15) > PRIMARY KEY NOT NULL, " + > "[PHONENUMBER] NVARCHAR(15) NOT > NULL);" ); > > public boolean deletePhoneNumber(String phonenumber) > { > open(); > db.beginTransaction(); > > int rowsDeleted = db.delete(ECHOLIST_TABLE, PHONENUMBER_ID + > "=" + phonenumber, null); > > //int rowsDeleted = db.delete(ECHOLIST_TABLE, null, null); > > db.setTransactionSuccessful(); > db.endTransaction(); > close(); > > return (rowsDeleted > 0); > } > > -- > 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 > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en