0

我在我的方法中使用以下查询

 Cursor c = sqLiteDatabase.rawQuery("SELECT Content3 FROM " +
             MYDATABASE_TABLE +
             " where Content1 = '"+value1+"'", null);

但它抛出异常并且应用程序被强制关闭。我将 value1 传递给该方法。Logcat如下

09-21 17:14:21.242: ERROR/AndroidRuntime(16511): FATAL EXCEPTION: main
09-21 17:14:21.242: ERROR/AndroidRuntime(16511): android.database.sqlite.SQLiteException: no such column: Content3: , while compiling: SELECT Content3 FROM photodetails where Content1 = '2192012'
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:65)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:83)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:49)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1356)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1324)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at roman10.tutorial.fileobserver.SQLiteAdapter.fetchresult(SQLiteAdapter.java:80)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at roman10.tutorial.fileobserver.FileModificationMonitor$3.onClick(FileModificationMonitor.java:56)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.view.View.performClick(View.java:2485)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.view.View$PerformClick.run(View.java:9080)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.os.Handler.handleCallback(Handler.java:587)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.os.Handler.dispatchMessage(Handler.java:92)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.os.Looper.loop(Looper.java:130)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at android.app.ActivityThread.main(ActivityThread.java:3687)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at java.lang.reflect.Method.invokeNative(Native Method)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at java.lang.reflect.Method.invoke(Method.java:507)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
09-21 17:14:21.242: ERROR/AndroidRuntime(16511):     at dalvik.system.NativeStart.main(Native Method)

请指出我的错误。谢谢

4

1 回答 1

0

最后我得到了我的问题的解决方案。只需删除文件资源管理器中的 db-->data/data/packagename/dbname。并再次运行。现在它工作正常。

于 2012-09-24T07:09:21.303 回答