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.

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);
    }

--



Sqlite Delete doesn't delete

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


 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






>


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. Harus sun java

Malem gan,
Ane nyubi yg sgt gaptek nih.
Ane punya Tab,mau buka aplikasi.
Ternyata aplikasi itu bisa dibuka kalo kita udah install sun java.

Mohon inpoh dr agan2,siapa tau ada yg bs tau cara ngakalinya.
Terima kasih


Powered by Telkomsel BlackBerry

-- 
"

2. Google maps 5.3.1

syd
ptk
a10 _o
....._\\>,
...(_)/(_)

-- 
"

<<attachment: Screenshot-1302829916537.png>>

3. Google maps update 5.3.1

4. How to design the function to select the text?

5. Progressive download with MediaPlayer

6. Read and write file at same time?

7. SoftKeyboard with transparent background