SQLite Database Update Operation Query
If we want to update the recored in sqlite Database we have two condition to update it.
Simple Update Query
Multiple Where Condition Update Query
Simple Update Query
long updateStudent(String id, String name,String fatherName,String className){
SQLiteDatabase sqLiteDatabase=this.getReadableDatabase();
ContentValues contentValues=new ContentValues();
contentValues.put("firstName", name);
contentValues.put("fatherName", fatherName);
contentValues.put("className", className);
return sqLiteDatabase.update("Student",contentValues,"Id = ?",new String[]{id});
}
Multiple Where Condition Update Query
public long updateReminder(String Status, String medicine, String remarks) { SQLiteDatabase sq = this.getReadableDatabase(); ContentValues c = new ContentValues(); c.put("Status", Status); return sq.update("REMINDERS", c, "Medicine" + " = ? AND " + "Remarks" + " = ?", new String[]{medicine, remarks}); }
Comments
Post a Comment