no such column:SQL语句包含数据库表中不存在的列名

Android 2.3.3  
Eclipse Version: 3.7.0  
Console  


LogCat  报错信息:

02-24 09:10:51.176: ERROR/AndroidRuntime(431): android.database.sqlite.SQLiteException: no such column: phone: , while compiling: SELECT * FROM Task WHERE phone=? and status=1
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:65)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:83)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:49)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1356)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1235)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1189)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1271)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at com.taobao.htc.db.TaskDBHelper.find_Phone(TaskDBHelper.java:55)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at com.taobao.htc.TaskDBopt.find_Phone(TaskDBopt.java:154)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at com.taobao.htc.manage.ImportTask.startImport(ImportTask.java:175)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at com.taobao.htc.manage.ImportTask$3.run(ImportTask.java:117)
02-24 09:10:51.176: ERROR/AndroidRuntime(431):     at java.lang.Thread.run(Thread.java:1019)


主要错误:

02-24 09:10:51.176: ERROR/AndroidRuntime(431): android.database.sqlite.SQLiteException: no such column: phone: , while compiling: SELECT * FROM Task WHERE phone=? and status=1


发生错误原因分析:

数据库中Task表的列名没有phone这一列。检查创建数据库表的代码,发现在建Task表时,确实没有phone列。

 

解决办法:

在创建数据库的Task表时添加phone列。

你可能感兴趣的:(eclipse,sql,数据库,android)