Blackbelt
Blackbelt

Reputation: 157467

Remove multiple rows from contentprovider

I tried to remove two rows from my content provider with no success. Here's the query;

int rowdelted = 
       con.getContentResolver().delete(CONTENT_URI, clausole, null);

where clausole is a string like "_ID = 100 AND _ID = 101 AND _ID = 102".

Is there anything wrong?

Thanks in advance

Upvotes: 4

Views: 2769

Answers (2)

Andriy Burmistrov
Andriy Burmistrov

Reputation: 61

String clausole = "_ID IN (100, 101, 102)";

or use range

String clausole = "_ID => 100 AND _ID <= 102";

Upvotes: 0

nicholas.hauschild
nicholas.hauschild

Reputation: 42849

Each row has 1 ID, and to attempt to remove a single row with id of 100, and 101, and 102, would not work.

You probably mean to be OR'ing the values.

String clausole = "_ID = 100 OR _ID = 101 OR _ID = 102";

Upvotes: 3

Related Questions