![](https://img-blog.csdnimg.cn/img_convert/168b55f6285cf4a96febfe2eb6ef408d.png)
2.获得SQLiteDatabase对象操作数据
public void delete(){
String[] strings = new String[]{"20","1"};
//方式一
database.execSQL("DELETE FROM userInfo WHERE age=?",strings);
//方式二
database.delete("userInfo","age=? or sex=?",strings);
}
public void update(){
String sql = "update userInfo set age = ? where age = ? or uname=?";
String[] strings = new String[]{"25","戴鑫"};
//方式一
database.execSQL(sql,strings);
ContentValues contentValues = new ContentValues();
contentValues.put("age",35);
contentValues.put("uname","戴金");
//方式二
database.update("userInfo",contentValues,"age=? or uname=?",strings);
}