Sqlite Delete doesn't delete

by Wall-E » Fri, 13 Aug 2010 23:16:00 GMT

Sponsored Links
 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.

                                        "[PHONENUMBER_ID] NVARCHAR(15) PRIMARY 
                                        "[PHONENUMBER] NVARCHAR(15) NOT NULL);" 

public boolean deletePhoneNumber(String phonenumber)

        int rowsDeleted = db.delete(ECHOLIST_TABLE, PHONENUMBER_ID +
                        "=" + phonenumber, null);

        //int rowsDeleted = db.delete(ECHOLIST_TABLE, null, null);


                return (rowsDeleted > 0);


Sqlite Delete doesn't delete

by Chris Stewart » Fri, 13 Aug 2010 23:20:03 GMT

 I use db.execSQL to delete.

Chris Stewart

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


Sponsored Links

Sqlite Delete doesn't delete

by Farjad Habib » Fri, 13 Aug 2010 23:20:32 GMT

 give the phonenumber in single quotes....like below

PHONENUMBER_ID + "='" + phonenumber +"'"


Sqlite Delete doesn't delete

by RichardC » Fri, 13 Aug 2010 23:22:44 GMT

 Try putting quotes around the phonenumber string


Sqlite Delete doesn't delete

by Wall-E » Sat, 14 Aug 2010 00:08:23 GMT

 Thanks everybody, yea the problem is that the WHERE clause was using
my string value without the quotes.


Other Threads

1. Simultaneous audio playback and record?

Is it possible to simultaneously play an audio file while recording
via the microphone?  When I start a recording audio in the standard
way with the  MediaRecorder class, and then start playing back audio
in the standard way with the MediaPlayer class (on an HTC Magic), it
seems that the recorder is cut off when the player starts, resulting
in an empty shell of a 3gp file.


2. How to set Adapter extending BaseAdapter to single choice list


I have a class which extends ListActivity

public class GenericListActivity extends ListActivity
        protected void onCreate(Bundle savedInstanceState)

                setListAdapter(new GenericListAdapter(this));

public class GenericListAdapter extends BaseAdapter
        public GenericListAdapter(Context context)

        public View getView(int position, View convertView, ViewGroup
                convertView = mInflater.inflate
(R.layout.genericlistview, null);
                return convertView;

Here everything works fine. Now I want this adapter to work like the
ArrayAdapter having the property of
android.R.layout.simple_list_item_single_choice. That is single item
choicable like the ArrayAdapter of this next line

setListAdapter(new ArrayAdapter<String>(this,

GENRES = an array of string

I just want the views returned by getView method of the
GenericListAdapter should be single choice list items in the

Please help me


3. Can I use the picture of Dev Phone 1 in my app? (copyright question)

4. Inserting small icon over Image

5. Error during preparation

6. Keeping writable database instance open... Bad practice?

7. GridView vs. horizontal scroll