我有一个从 sqlite 数据库填充的 Listview。数据库是通过以下方式创建的:
egrohDB.execSQL("CREATE TABLE IF NOT EXISTS " + EGROH_DB_TABLE_ITEMS +
" (ident integer primary key AUTOINCREMENT, " +
"id integer(15), " +
...
要从我使用的数据库中获取数据rawQueries
并插入我正在使用的数据InsertHelper
。我在表格中添加了一行。现在我得到一个IllegalArgumentException
mit id 行是无效的。
06-02 17:48:24.340: E/AndroidRuntime(23200): FATAL EXCEPTION: main
06-02 17:48:24.340: E/AndroidRuntime(23200): java.lang.IllegalArgumentException: column 'id' is invalid
06-02 17:48:24.340: E/AndroidRuntime(23200): at android.database.DatabaseUtils$InsertHelper.getColumnIndex(DatabaseUtils.java:1078)
06-02 17:48:24.340: E/AndroidRuntime(23200): at com.y5apps.DatabaseController.insertData(DatabaseController.java:273)
06-02 17:48:24.340: E/AndroidRuntime(23200): at com.y5apps.EgrohCatalogue.parseData(EgrohCatalogue.java:149)
06-02 17:48:24.340: E/AndroidRuntime(23200): at com.y5apps.EgrohCatalogue$3.onClick(EgrohCatalogue.java:319)
06-02 17:48:24.340: E/AndroidRuntime(23200): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166)
06-02 17:48:24.340: E/AndroidRuntime(23200): at android.os.Handler.dispatchMessage(Handler.java:99)
06-02 17:48:24.340: E/AndroidRuntime(23200): at android.os.Looper.loop(Looper.java:137)
06-02 17:48:24.340: E/AndroidRuntime(23200): at android.app.ActivityThread.main(ActivityThread.java:4424)
06-02 17:48:24.340: E/AndroidRuntime(23200): at java.lang.reflect.Method.invokeNative(Native Method)
06-02 17:48:24.340: E/AndroidRuntime(23200): at java.lang.reflect.Method.invoke(Method.java:511)
06-02 17:48:24.340: E/AndroidRuntime(23200): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-02 17:48:24.340: E/AndroidRuntime(23200): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-02 17:48:24.340: E/AndroidRuntime(23200): at dalvik.system.NativeStart.main(Native Method)
错误出现在这一行:
final int id_c = ih.getColumnIndex("id");
我不知道这个例外是什么意思。该怎么办?