Sqlite Not Inserting Data In 2nd Table
This code was working fine with one table....and was attaching file Now I want to create two tables first activity is inserting data in table1...but second activity is not inserti
Solution 1:
when you are inserting the data in same row , you should update the row instead of again calling insert. for eg:-
ContentValuescv=newContentValues();
cv.put("Field1","value"); //These Fields should be your String values of
and then call update instead of insert
myDB.update(TableName, cv, "_id="+id, null);
you can refer this
Solution 2:
This works fine now
publicbooleanupdate(String Res, String Gen){ SQLiteDatabase db =
this.getWritableDatabase(); ContentValues contentValues =newContentValues(); contentValues.put(CoL_4,Res); contentValues.put(CoL_5,Gen);
db.update(TABLE_NAME,contentValues, "Residence = ?",newString[] { "A" });
returntrue; }
Post a Comment for "Sqlite Not Inserting Data In 2nd Table"