failed to read row 0,column -1

后端 未结 4 1739
天命终不由人
天命终不由人 2021-02-18 15:53

I am trying to copy a database that I made with SQLite manager, in which I did:

CREATE TABLE \"android_metadata\" (\"locale\" TEXT DEFAULT \'en_US\')
         


        
4条回答
  •  再見小時候
    2021-02-18 16:29

    if you see

    failed to read row 0,column -1
    

    It means you are trying to read from a column which doesn't exist.

    If it cannot find the column name that you specify, Cursor.getColumnIndex() returns -1 and hence, is invalid.

    There are two reasons for this:

    1. The column does not exist.
    2. The name of the column is incorrect. (so does not exist).

    Note: the name of the column is CASE SENSITIVE when using getColumnIndex()


    In your scenario:

     c.getString(c.getColumnIndex(CNAME));
    

    Check that the CNAME variable is spelt correctly, and that a column of that name exists.

    String CNAME=" ques"
    

    Should that extra leading white space be there for example..

提交回复
热议问题