Android ORM and androidorm
4. Update Data
ContentValues value = new ContentValues (); value. put ("name", "Computer Network 2"); DataSupport. update (MyClass. class, values, 0 );
The above is the record for updating an ID. If the record is updated according to the condition, you can use the following method:
ContentValues values = new ContentValues (); values. put ("Studytime", "100"); DataSupport. updateAll (MyClass. class, values, "Studytime>? "," 100 ");
You can also not use ContentValues to update:
MyClass updateClass = new MyClass (); updateClass. setStudytime ("100"); updateClass. updateAll ("Studytime <? "," 100 ");
5. delete data
Delete data of a specified ID:
DataSupport. delete (MyClass. class, 0 );
Delete based on conditions:
DataSupport. deleteAll (MyClass. class, "Id>? "," 5 ");
Delete all data:
DataSupport. deleteAll (MyClass. class );