Delete row in database table given one column value - which is a string

前端 未结 4 795
旧时难觅i
旧时难觅i 2020-12-03 11:09

I have a table with column headings: | _id (long) | Name (String) | x (integer) | y (integer) |

I want to delete the row in the table that has Name myName.



        
4条回答
  •  星月不相逢
    2020-12-03 11:39

    Sure, that works, although I would recommend

    dbHelper.delete(DATABASE_TABLE_2, KEY_NAME + "=?", new String[] { myName })
    

    for safety reasons. That way, you can have special characters without breaking your query. Did this not work?

提交回复
热议问题