本文介绍了android.database.sqlite.SQLiteConstraintException:错误code 19:约束失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是错误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)

和这是所使用的方法

this.db.execSQL("INSERT INTO itemGalleryItems (id, imageCaption, imageUrl,itemID,orderIndex,displayInGallery) VALUES (?,?,?,?,?,?); ",
                        bindArgs);

在binArgs如下:

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")};

希望有人能帮助

感谢名单
newone

thanxnewone

推荐答案

我觉得如果你有自动增量领域,你不应该将其包含在查询......是ID自动增量?

I think if you have autoincrement field, you shouldn't include it in the query... is the "id" autoincrement?

这篇关于android.database.sqlite.SQLiteConstraintException:错误code 19:约束失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 13:59