Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

android sqlite insert or replace

SQLiteDatabase db=this.getWritableDatabase();
ContentValues cv=new ContentValues();
        cv.put("columName1",YOUR_VAR);
        cv.put("columName2",YOUR_VAR);
        cv.put("columName3",YOUR_VAR);
int response=db.update("YourTable",cv,"columName = ?"+ new String[]{YOUR_VAR})
  if(response==0){
    db.insert("Your_table",null,cv);
  }
 
PREVIOUS NEXT
Tagged: #android #sqlite #insert #replace
ADD COMMENT
Topic
Name
4+7 =