SQLite: Cannot bind argument at index 1 because the index is out of range. The statement has 0 parameters

后端 未结 2 1217
闹比i
闹比i 2020-12-24 10:18

I\'m getting the following error, and I have no idea why it is occurring. I was wondering if anyone else might be able to shed some light on the issue.

12-2         


        
相关标签:
2条回答
  • 2020-12-24 10:50

    In my case I had the question mark inside single quotes like this '?'. Removing the single quotes resolved the error.

    Copied from theblang's comment above.

    0 讨论(0)
  • 2020-12-24 11:03

    The selection should be an expression and selectionArgs should have as many elements as there are ? literal placeholders in selection.

    Your selection is not an expression and does not have any ? but you have one element in selectionArgs.

    You probably want something like:

    String selection =  PlayerEntry.COLUMN_NAME_PLAYER_NAME + "=?";
    

    to make it an expression that matches the player name column agains the literal you're binding in selectionArgs[0].

    0 讨论(0)
提交回复
热议问题