我想在我的應用程序中創建一個SQLite數據庫,將其導出到SD卡。我收到錯誤SQLite錯誤1無列SQLite插入錯誤
12月1日至13日:31:39.621:I /數據庫(3828):sqlite的返回:錯誤碼= 1,味精=表庫存沒有列命名的位置
SQLite的插入錯誤
這是我創建數據庫的代碼...我似乎無法找到問題。
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE inventory ("
+ "_id INTEGER PRIMARY KEY," + "serialnum TEXT,"
+ "modelnum TEXT," + "manufact TEXT," + "description TEXT,"
+ "time DATETIME" + ");");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion < 2) {
Log.d("SW","Upgrading database from version " + oldVersion + " to " + newVersion);
db.execSQL("ALTER TABLE inventory ADD location TEXT");
}
if (oldVersion < 3) {
Log.d("SW","Upgrading database from version " + oldVersion + " to " + newVersion);
db.execSQL("ALTER TABLE inventory ADD other TEXT");
}
}
通過開放源代碼項目,我的工作是關閉的方式http://code.google.com/p/simplescan/source/checkout謝謝 – KDEx 2012-01-13 20:11:45