Skip to content Skip to sidebar Skip to footer

Sqlite Exception While Trying To Delete Row

I'm getting error: android.database.sqlite.SQLiteException: near ':BE': syntax error (code 1): , while compiling: DELETE FROM device WHERE address=C4:BE:84:18:D5:A5 while try

Solution 1:

use address with single quotes

DELETEFROM device WHERE address='C4:BE:84:18:D5:A5'

Solution 2:

Try this.

int removedId = database.delete(MySQLiteHelper.TABLE_DEVICE
            , MySQLiteHelper.KEY_ADDRESS +  "= ?",new String[] {address});

Solution 3:

use this :

sqLiteDatabase.delete("Table", "row= ?", new String[]{String.valueOf(value)});

Post a Comment for "Sqlite Exception While Trying To Delete Row"