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

前端 未结 4 784
旧时难觅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

    just try this simple code

    private void deleteItem()
     {
        try 
          {
          SQLiteDatabase db = mOpenHelper.getWritableDatabase();
          db.delete(TABLE_NAME, " title = 'haiyang'", null);
          setTitle("title");
        } catch (SQLException e) {
    
        }
    

提交回复
热议问题