If the SQL statement contains fields not in the table, the following error occurs:
- Android 2.3.3
- Eclipse Version: 3.7.0
- Console
LogCat error message:
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): Android. database. sqlite. SQLiteException: no such column: iphone :,WhileCompiling: SELECT * FROM Mobile WHERE iphone =? And status =1
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At android. database. sqlite. SQLiteCompiledSql. native_compile (Native Method)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At android. database. sqlite. SQLiteCompiledSql. compile (SQLiteCompiledSql. java:92)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At android. database. sqlite. SQLiteCompiledSql. <init> (SQLiteCompiledSql. java:65)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At android. database. sqlite. SQLiteiphone. <init> (SQLiteiphone. java:83)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At android. database. sqlite. SQLiteQuery. <init> (SQLiteQuery. java:49)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At android. database. sqlite. SQLiteDirectCursorDriver. query (SQLiteDirectCursorDriver. java:42)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At android. database. sqlite. SQLiteDatabase. rawQueryWithFactory (SQLiteDatabase. java:1356)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At android. database. sqlite. SQLiteDatabase. queryWithFactory (SQLiteDatabase. java:1235)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At android. database. sqlite. SQLiteDatabase. query (SQLiteDatabase. java:1189)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At android. database. sqlite. SQLiteDatabase. query (SQLiteDatabase. java:1271)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At com. tmall. nokia. db. MobileDBHelper. find_Iphone (MobileDBHelper. java:55)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At com. tmall. nokia. MobileDBopt. find_Iphone (MobileDBopt. java:154)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At com. tmall. nokia. manage. Mobile. startImport (Mobile. java:175)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At com. tmall. nokia. manage. Mobile $3. Run (Mobile. java:117)
- 02-23 11:20:41.360: ERROR/AndroidRuntime (4366): At java. lang. Thread. run (Thread. java:1019)
Major Errors:
02-23 11:20:41.360: ERROR/AndroidRuntime (4366): Android. database. sqlite. SQLiteException: no such column: iphone :,WhileCompiling: SELECT * FROM Mobile WHERE iphone =? And status =1
Cause analysis:
When querying the iphone from the Mobile table, we found that the Mobile table of the database does not have the iphone column. Check the code for creating a database table and find that there is no iphone field in the Mobile table.
Solution:
Add the iphone column when creating the Mobile table of the database.