I get the IllegalArgumentException above when executing the function below. What I don't get is that when I run the debugger, the values variable clearly only contains 4 arguments, as it should.
So...
(1) Where does this mysterious fifth argument come from?
(2) How should I approach finding this error?
db.update(
UppdragEntry.TABLE_NAME,
values,
selection,
selectionArgs);
Selection contains the following: String selection = "_id"; String[] selectionArgs = {" =" + personId};
You have a value in selectionArgs
but no ?
placeholder for it in selection
.
Change it to
String selection = "_id = ?";
String[] selectionArgs = { "" + personId };
The method builds an SQL string. Supplied ContentValues
are built as ?
placeholder and bind arguments. Additional selection args are also provided as bind arguments and they must be matched with equal number of ?
placeholders.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With