android sqlite insert or replace

Solutions on MaxInterview for android sqlite insert or replace by the best coders in the world

showing results for - "android sqlite insert or replace"
Emilia
12 Apr 2019
1SQLiteDatabase db=this.getWritableDatabase();
2ContentValues cv=new ContentValues();
3        cv.put("columName1",YOUR_VAR);
4        cv.put("columName2",YOUR_VAR);
5        cv.put("columName3",YOUR_VAR);
6int response=db.update("YourTable",cv,"columName = ?"+ new String[]{YOUR_VAR})
7  if(response==0){
8    db.insert("Your_table",null,cv);
9  }