Error Code: 1 (SQLITE_ERROR) syntax error

DELETE FROM Table_Name WHERE SingerName='Name Singer - ev'ry time') 

As you can see the name of the composition contains the symbol " ' " (Name Singer - ev'ry time), actually because of this there is a problem of deleting the string by this command. We delete using SQLiteDatabase sdb.delete () ;. What are the solutions? Does it make sense to use StringReader?

    1 answer 1

    Symbol can be escaped

     DELETE FROM Table_Name WHERE SingerName='Name Singer - ev''ry time' 

    Although I will not mind why you need it. When parameters are substituted, automatic screening occurs.

     sdb.delete("Table_Name", "SingerName = ?", new String[] { "Name Singer - ev'ry time" }); 
    • Thanks for the answer! Just with sdb.delete("Table_Name", SINGER_NAME + "='" + getSong() + "'", null); There is no screening .. - Stanislav Derepovsky