Summary of Common Errors of provider/SQLite.

Source: Internet
Author: User

In Android, operations on the database may result in errors from time to time, and sometimes it takes only half a day to find the real reason. Here, I will record my experiences.

1,Bad request for field slot 0,-1. numrows = 2, numcolumns = 14

Java. Lang. illegalstateexception: Get field slot from row 0 col-1 failed

(1) The reason is that the field name you added to the database is different from the field name used for query (that is, the word is wrong, including case and space ). This error is easy to find.

(2 .)Before passing the cursor object, I had a problem with the query condition of the cursor. If I did not write a certain column, then I encountered the problem shown above. Then I changed the query condition so that it would be okay.

Private Static final string [] underlying_columns = new string [] {downloads. impl. _ id, downloads. impl. _ DATA + "as" + column_local_filename, downloads. column_title, downloads. column_description, downloads. column_uri, downloads. column_mime_type, downloads. impl. _ DATA };
 
 
 
Public cursor query (query) {cursor underlyingcursor = query. runquery (mresolver, underlying_columns, mbaseuri); If (underlyingcursor = NULL) {return NULL;} return New cursortranslator (underlyingcursor, mbaseuri );}

MainIs the collection of the above fields during the query (Underlying_columns) You write less fields to be queried, for example:

If you are notUnderlying_columns
Downloads. impl. _ data field. If you use this field in subsequent operations, this error will occur.

I encountered such an error. It took two hours to find the cause... Time is so expensive !!!!!


2,


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.