this is the error code:
09-27 11:56:01.425: WARN/System.err(10324): android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
09-27 11:56:01.435: WARN/System.err(10324): at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
09-27 11:56:01.435: WARN/System.err(10324): at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:61)
09-27 11:56:01.435: WARN/System.err(10324): at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1809)
09-27 11:56:01.435: WARN/System.err(10324): at de.enough.appmate.dbase.CMSResource.updateItem(CMSResource.java:1103)
09-27 11:56:01.435: WARN/System.err(10324): at de.enough.appmate.dbase.CMSResourceUpdater.updateItems(CMSResourceUpdater.java:178)
09-27 11:56:01.435: WARN/System.err(10324): at de.enough.appmate.dbase.CMSResourceUpdater.loadUpdates(CMSResourceUpdater.java:102)
09-27 11:56:01.435: WARN/System.err(10324): at de.enough.appmate.dbase.CMSResourceUpdaterRunnable.run(CMSResourceUpdaterRunnable.java:32)
09-27 11:56:01.435: WARN/System.err(10324): at java.lang.Thread.run(Thread.java:1019)
and this is the method that is used
this.db.execSQL("INSERT INTO itemGalleryItems (id, imageCaption, imageUrl,itemID,orderIndex,displayInGallery) VALUES (?,?,?,?,?,?); ",
bindArgs);
the binArgs looks like:
String[] bindArgs = {
(String) imageItem.get("id"),
(String) imageItem.get("imageCaption"),
(String) imageItem.get("imageName"),
(String) item.get("id"),
(String) imageItem.get("orderIndex"),
(String) imageItem.get("displayInGallery")};
hope someone can help
thanx newone
I have fixed this error;
instead of
long sucess = db.insert(TABLE_NAME_CONTACT_EXTRA, null, row);
use this to insert data in database
long sucess = db.insertWithOnConflict(TABLE_NAME_CONTACT_EXTRA, null,
row, SQLiteDatabase.CONFLICT_IGNORE);
I think if you have autoincrement field, you shouldn't include it in the query... is the "id" autoincrement?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With