我在我的小型Android应用程序中收到以下错误消息:
SQLiteException:table depot没有名为price_per_unit的列:,同时编译INSERT INTO depot(...)
但是,到底怎么会发生这种情况?我使用元数据类来提供所有名称:
我的创建表就是这个:
db.execSQL("CREATE TABLE " + DepotTableMetaData.TABLE_NAME + " ("
+ DepotTableMetaData._ID + " INTEGER PRIMARY KEY,"
+ DepotTableMetaData.ITEM_QRCODE + " INTEGER,"
+ DepotTableMetaData.ITEM_NAME + " TEXT,"
+ DepotTableMetaData.ITEM_AMOUNT + " DOUBLE,"
+ DepotTableMetaData.ITEM_UNIT + " TEXT,"
+ DepotTableMetaData.ITEM_PPU + " DOUBLE,"
+ DepotTableMetaData.ITEM_TOTAL + " DOUBLE,"
+ DepotTableMetaData.ITEM_COMMENT + " TEXT,"
+ DepotTableMetaData.CREATED_DATE + " INTEGER,"
+ DepotTableMetaData.MODIFIED_DATE + " INTEGER"
+ ");");
虽然我的DepotTableMetaData.ITEM_PPU
完全意味着price_per_unit
,但我再也没有打电话给price_per_unit
,我只将其称为DepotTableMetaData_ITEM_PPU
。这可能是什么?
答案 0 :(得分:0)
变量'DepotTableMetaData.ITEM_PPU'可能设置为'price_per_unit'。