When operating the SQLite database, the following error occurs: "The bound or column index is out of range"

Source: Internet
Author: User

Html code

  1. Android 2.3.3
  2. Eclipse Version: 3.7.0
  3. LogCat

LogCat error message:

Java code
  1. 02-13 09:21:35.030: WARN/dalvikvm (17173): Threadid =19: Thread exiting with uncaught exception (group =Zero x 40015560)
  2. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): Fatal exception: Thread-26
  3. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): Android. database. sqlite. SQLiteException: bind or column index out of range: handle0x309b08
  4. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At android. database. sqlite. SQLiteProgram. native_bind_string (Native Method)
  5. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At android. database. sqlite. SQLiteProgram. bindString (SQLiteProgram. java:244)
  6. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At android. database. sqlite. SQLiteQuery. bindString (SQLiteQuery. java:185)
  7. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At android. database. sqlite. SQLiteDirectCursorDriver. query (SQLiteDirectCursorDriver. java:48)
  8. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At android. database. sqlite. SQLiteDatabase. rawQueryWithFactory (SQLiteDatabase. java:1356)
  9. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At android. database. sqlite. SQLiteDatabase. queryWithFactory (SQLiteDatabase. java:1235)
  10. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At android. database. sqlite. SQLiteDatabase. query (SQLiteDatabase. java:1189)
  11. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At android. database. sqlite. SQLiteDatabase. query (SQLiteDatabase. java:1271)
  12. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At com. tmall. nokia. db. RecordDBHelper. query (RecordDBHelper. java:50)
  13. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At com. tmall. nokia. manage. RecordDBopt. get (RecordDBopt. java:78)
  14. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At com. tmall. nokia. manage. RecordMessage. sendMseeage (RecordMessage. java:111)
  15. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At com. tmall. nokia. manage. RecordMessage. sendMseeage (RecordMessage. java:87)
  16. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At com. tmall. nokia. Report. run (Report. java:49)
  17. 02-13 09:21:35.130: ERROR/AndroidRuntime (17173): At java. lang. Thread. run (Thread. java:1019)
  18. 02-13 09:21:35.200: WARN/ActivityManager (62): Force finishing activity com. tmall. nokia/. Iphone

Cause analysis:
Here at com. tmall. nokia. db. RecordDBHelper. query (RecordDBHelper. java: 50) has a problem:

Java code
  1. Cursor cur = db. query (TBL_NAME,Null, Where, args,Null,Null, Order );

Follow the error Log prompt to continue searching for the error location. It is found that the length of the input parameter where is different from that of the args array. Therefore, the error "android. database. sqlite. SQLiteException: bind or column index out of range" is reported (the bound or column index is out of the range ).

Solution:
After finding the cause of the error, modify the input parameter to ensure that the where parameter is consistent with the args length.

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.