开发者

android.database.sqlite.SQLiteException: near "("

this is my error:

09-27 08:16:34.547: WARN/System.err(8366):     at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
09-27 08:16:34.547: WARN/System.err(8366):     at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92)
09-27 08:16:34.547: WARN/System.err(8366):     at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:65)
09-27 08:16:34.547: WARN/System.err(8366):     at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:83)
09-27 08:16:34.547: WARN/System.err(8366):     at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:41)
09-27 08:16:34.547: WARN/System.err(8366):     at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1149)
09-27 08:16:34.547: WARN/System.err(8366):     at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1802)
09-27 08:16:34.557: WARN/System.err(8366):     at de.enough.appmate.dbase.CMSResource.updateItem(CMSResource.java:1168)
09-27 08:16:34.557: WARN/System.err(8366):     at de.enough.appmate.dbase.CMSResourceUpdater.updateItems(CMSResourceUpdater.java:179)
09-27 08:16:34.557: WARN/System.err(8366):     at de.enough.appmate.dbase.CMSResourceUpdater.loadUpdates(CMSResourceUpdater.java:102)
09-27 08:16:34.557: WARN/System.err(8366):     at de.enough.appmate.dbase.CMSResourceUpdaterRunnable.run(CMSResourceUpdaterRunnable.java:32)
09-27 08:16:34.557: WARN/System.err(8366):     at java.lang.Thread.run(Thread.java:1019)

and this is my code of updateItem method where the database should be updated:

this.db.execSQL("UPDATE " + CMSConstants.ITEMS + " SET ( " +
                    CMSConstants.ID + ", " +
                    CMSConstants.TITLE + ", " +
                    CMSConstants.IS_PAGE + ", " +
                    CMSConstants.IS_HIDDEN + ", " +
                    CMSConstants.ITEM_TYPE + ", " +
                    CMSConstants.ORDER_INDEX + ", " +
                    CMSConstants.SECTION_ID + ", " +
                    CMSConstants.TABLE_SECTION_NAME + ", " +
                    CMSConstants.TABLE_SECTION_ID + ", " +
                    CMSConstants.IMAGE1_FILE + ", " +
                    CMSConstants.IMAGE1_CAPTION + ", " +
                    CMSConstants.IMAGE1_DISPLAY_IN_GALLERY + ", " +
                    CMSConstants.CATEGORY1 + ", " +
                    CMSConstants.CATEGORY2 + ", " +
                    CMSConstants.GEO_LONGITUDE + ", " +
                    CMSConstan开发者_JAVA百科ts.GEO_LATITUDE + ", " +
                    CMSConstants.DESCRIPTION + ", " +
                    CMSConstants.KEYWORDS + ", " +
                    CMSConstants.BLOCKWORDS + ", " +
                    CMSConstants.CLEAN_NAME + ", " +
                    CMSConstants.ADDITIONAL_FIELD1_NAME + ", " +
                    CMSConstants.ADDITIONAL_FIELD1_VALUE + ", " +
                    CMSConstants.ADDITIONAL_FIELD2_NAME + ", " +
                    CMSConstants.ADDITIONAL_FIELD2_VALUE + ", " +
                    CMSConstants.ADDITIONAL_FIELD3_NAME + ", " +
                    CMSConstants.ADDITIONAL_FIELD3_VALUE + ", " +
                    CMSConstants.ADDITIONAL_FIELD4_NAME + ", " +
                    CMSConstants.ADDITIONAL_FIELD4_VALUE + ", " +
                    CMSConstants.ADDRESS_LINE1 + ", " +
                    CMSConstants.ADDRESS_LINE2 + ", " +
                    CMSConstants.ADDRESS_LINE3 + ", " +
                    CMSConstants.ADDRESS_LINE4 + ", " +
                    CMSConstants.ADDRESS_LINE5 + ", " +
                    CMSConstants.ADDRESS_POSTCODE + ", " +
                    CMSConstants.CONTACT_EMAIL + ", " +
                    CMSConstants.CONTACT_EMAIL_DISPLAY + ", " +
                    CMSConstants.CONTACT_EMAIL_SUBJECT + ", " +
                    CMSConstants.CONTACT_TEL + ", " +
                    CMSConstants.CONTACT_TEL_DISPLAY + ", " +
                    CMSConstants.CONTACT_WEB + ", " +
                    CMSConstants.CONTACT_WEB_DISPLAY + ", " +
                    CMSConstants.MODIFICATION_DATE + ", " +
                    CMSConstants.PAGE_HEADER +
                    " ) VALUES ( " +
                    "?,?,?,?,?,?,?,?,?,?," +
                    "?,?,?,?,?,?,?,?,?,?," +
                    "?,?,?,?,?,?,?,?,?,?," +
                    "?,?,?,?,?,?,?,?,?,?," +
                    "?,?,? );", bindArgs);

I don't understand where the problem is. I looked on the code and there is no problem near "(".

Hope someone can help me.

thanx newone

EDIT: This is my new query

this.db.execSQL("UPDATE " + CMSConstants.ITEMS + " SET " +
                CMSConstants.ID + "= ?, " +
                CMSConstants.TITLE + " = ?, " +
                CMSConstants.IS_PAGE + " = ?, " +
                CMSConstants.IS_HIDDEN + " = ?, " +
                CMSConstants.ITEM_TYPE + " = ?, " +
                CMSConstants.ORDER_INDEX + " = ?, " +
                CMSConstants.SECTION_ID + " = ?, " +
                CMSConstants.TABLE_SECTION_NAME + " = ?, " +
                CMSConstants.TABLE_SECTION_ID + " = ?, " +
                CMSConstants.IMAGE1_FILE + " = ?, " +
                CMSConstants.IMAGE1_CAPTION + " = ?, " +
                CMSConstants.IMAGE1_DISPLAY_IN_GALLERY + " = ?, " +
                CMSConstants.CATEGORY1 + " = ?, " +
                CMSConstants.CATEGORY2 + " = ?, " +
                CMSConstants.GEO_LONGITUDE + " = ?, " +
                CMSConstants.GEO_LATITUDE + " = ?, " +
                CMSConstants.DESCRIPTION + " = ?, " +
                CMSConstants.KEYWORDS + " = ?, " +
                CMSConstants.BLOCKWORDS + " = ?, " +
                CMSConstants.CLEAN_NAME + " = ?, " +
                CMSConstants.ADDITIONAL_FIELD1_NAME + " = ?, " +
                CMSConstants.ADDITIONAL_FIELD1_VALUE + " = ?, " +
                CMSConstants.ADDITIONAL_FIELD2_NAME + " = ?, " +
                CMSConstants.ADDITIONAL_FIELD2_VALUE + " = ?, " +
                CMSConstants.ADDITIONAL_FIELD3_NAME + " = ?, " +
                CMSConstants.ADDITIONAL_FIELD3_VALUE + " = ?, " +
                CMSConstants.ADDITIONAL_FIELD4_NAME + " = ?, " +
                CMSConstants.ADDITIONAL_FIELD4_VALUE + " = ?, " +
                CMSConstants.ADDRESS_LINE1 + " = ?, " +
                CMSConstants.ADDRESS_LINE2 + " = ?, " +
                CMSConstants.ADDRESS_LINE3 + " = ?, " +
                CMSConstants.ADDRESS_LINE4 + " = ?, " +
                CMSConstants.ADDRESS_LINE5 + " = ?, " +
                CMSConstants.ADDRESS_POSTCODE + " = ?, " +
                CMSConstants.CONTACT_EMAIL + " = ?, " +
                CMSConstants.CONTACT_EMAIL_DISPLAY + " = ?, " +
                CMSConstants.CONTACT_EMAIL_SUBJECT + " = ?, " +
                CMSConstants.CONTACT_TEL + " = ?, " +
                CMSConstants.CONTACT_TEL_DISPLAY + " = ?, " +
                CMSConstants.CONTACT_WEB + " = ?, " +
                CMSConstants.CONTACT_WEB_DISPLAY + " = ?, " +
                CMSConstants.MODIFICATION_DATE + " = ?, " +
                CMSConstants.PAGE_HEADER + " = ?"
                , bindArgs);

and this is the new error:

09-27 09:39:03.105: WARN/System.err(8903): android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
09-27 09:39:03.105: WARN/System.err(8903):     at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
09-27 09:39:03.115: WARN/System.err(8903):     at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:61)
09-27 09:39:03.115: WARN/System.err(8903):     at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1809)
09-27 09:39:03.115: WARN/System.err(8903):     at  de.enough.appmate.dbase.CMSResource.updateItem(CMSResource.java:1221)
09-27 09:39:03.115: WARN/System.err(8903):     at de.enough.appmate.dbase.CMSResourceUpdater.updateItems(CMSResourceUpdater.java:178)
09-27 09:39:03.115: WARN/System.err(8903):     at de.enough.appmate.dbase.CMSResourceUpdater.loadUpdates(CMSResourceUpdater.java:102)
09-27 09:39:03.115: WARN/System.err(8903):     at de.enough.appmate.dbase.CMSResourceUpdaterRunnable.run(CMSResourceUpdaterRunnable.java:32)
09-27 09:39:03.115: WARN/System.err(8903):     at java.lang.Thread.run(Thread.java:1019)


try this

this.db.execSQL("UPDATE " + CMSConstants.ITEMS + " SET "+CMSConstants.ID+"="+value)

i think your query is wrong..

simple update query

"UPDATE TABLE_NAME SET COLUMN_NAME=COLUMN_VALUE"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜