Android ORM and androidorm

Source: Internet
Author: User

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 );


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.