0

I have one table:

    CREATE TABLE People 
    (
       id INTEGER PRIMARY KEY AUTOINCREMENT, 
       name
    );

I wanted to delete some rows from the table by using its id as condition. So I tried to use this one but it was not working at all. So have a look:

    //idd is int
    SQLiteDatabase.delete
  (
    "People", 
    "id" + " = ?", 
    new String[]{String.valueOf(idd)}
  );

I dont know why it not working. It may because the String and int datatype. I figure it out something and it may work. But it use only two parameters instead of three. And I want to use three instead. So below is what I have figured out:

        SQLiteDatabase.delete
      (
        "People", 
        "id" + " = ?" + idd, 
       null
      );

So does anyone have any idea and help me out of this problem? I want to delete some rows from my table by using id as whereClause(second parameter) and idd variable which is integer as whereArg(3rd param) with delete function from SQLiteDatabase class.

2 Answers 2

1
SQLiteDatabase.delete("People", "id = " + idd, null);
Sign up to request clarification or add additional context in comments.

Comments

0

Try this code

public boolean deleteTitle(Integer idd) 

{

    return db.delete(DATABASE_TABLE, id + "=" + idd, null) > 0;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.