gpt4 book ai didi

java - 无效的请求sqlite android

转载 作者:太空宇宙 更新时间:2023-11-03 12:05:44 26 4
gpt4 key购买 nike

<分区>

对不起我的英语。不可能发出更新数据的有效请求。这是有效的:

    "UPDATE " + Names.TABLE_NAME + " SET " + Names.NamesColumns.FNAME + " = '" 
+ comment + "' WHERE " + BaseColumns._ID + " = " + l

但是我需要修改这两个字段:

    "UPDATE " + Names.TABLE_NAME + " SET " + Names.NamesColumns.NAMEDREAM
+ " = " + context + "," + Names.NamesColumns.DESCRIPTION + " = '" + description + "'
WHERE " + BaseColumns._ID + " = " + l

以及在此处添加对新值的请求会产生此类错误:

11-02 11:17:54.982: E/SQLiteLog(1479): (1) near "@53518c2c": syntax error 11-02 11:17:54.986: E/Controller(1479): Failed open database. 11-02 11:17:54.986: E/Controller(1479): android.database.sqlite.SQLiteException: near "@53518c2c": syntax error (code 1): , while compiling: UPDATE Dreams SET nameDream = android.app.ContextImpl@53518c2c,description = 'ZXC' WHERE _id = 12 11-02 11:17:54.986: E/Controller(1479): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) 11-02 11:17:54.986: E/Controller(1479): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882) 11-02 11:17:54.986: E/Controller(1479): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493) 11-02 11:17:54.986: E/Controller(1479): at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) 11-02 11:17:54.986: E/Controller(1479): at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:58) 11-02 11:17:54.986: E/Controller(1479): at android.database.sqlite.SQLiteStatement.(SQLiteStatement.java:31) 11-02 11:17:54.986: E/Controller(1479): at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1663) 11-02 11:17:54.986: E/Controller(1479): at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1594) 11-02 11:17:54.986: E/Controller(1479): at database.Controller.update(Controller.java:80) 11-02 11:17:54.986: E/Controller(1479): at com.example.firstv.ComplateDreams$2$1.onClick(ComplateDreams.java:92) 11-02 11:17:54.986: E/Controller(1479): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166) 11-02 11:17:54.986: E/Controller(1479): at android.os.Handler.dispatchMessage(Handler.java:99) 11-02 11:17:54.986: E/Controller(1479): at android.os.Looper.loop(Looper.java:137) 11-02 11:17:54.986: E/Controller(1479): at android.app.ActivityThread.main(ActivityThread.java:4745) 11-02 11:17:54.986: E/Controller(1479): at java.lang.reflect.Method.invokeNative(Native Method) 11-02 11:17:54.986: E/Controller(1479): at java.lang.reflect.Method.invoke(Method.java:511) 11-02 11:17:54.986: E/Controller(1479): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 11-02 11:17:54.986: E/Controller(1479): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 11-02 11:17:54.986: E/Controller(1479): at dalvik.system.NativeStart.main(Native Method)

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com