抱歉再次打扰,我是 Sqlite 新手,需要一些帮助。

我正在尝试更新表的单行中的单个文件。

我尝试这样做:

db.getWritableDatabase().execSQL("UPDATE data SET korean = "
+kopulito+ " WHERE _id = " + constantsCursor.getString(0), null);

但是我得到了上面提到的错误。
这是我的 LogCat。
05-05 09:58:07.776: E/AndroidRuntime(30495): FATAL EXCEPTION: main
05-05 09:58:07.776: E/AndroidRuntime(30495): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.koday/com.example.koday.MainActivity}: java.lang.IllegalArgumentException: Empty bindArgs
05-05 09:58:07.776: E/AndroidRuntime(30495):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at android.os.Looper.loop(Looper.java:130)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at android.app.ActivityThread.main(ActivityThread.java:3683)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at java.lang.reflect.Method.invokeNative(Native Method)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at java.lang.reflect.Method.invoke(Method.java:507)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at dalvik.system.NativeStart.main(Native Method)
05-05 09:58:07.776: E/AndroidRuntime(30495): Caused by: java.lang.IllegalArgumentException: Empty bindArgs
05-05 09:58:07.776: E/AndroidRuntime(30495):    at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1793)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at com.example.koday.MainActivity.updateall(MainActivity.java:301)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at com.example.koday.MainActivity.onCreate(MainActivity.java:72)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-05 09:58:07.776: E/AndroidRuntime(30495):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
05-05 09:58:07.776: E/AndroidRuntime(30495):    ... 11 more

非常感谢。

最佳答案

您可以使用 execSql 更新数据。
只需从 execSql 命令中删除 null 参数。

关于android - java.lang.IllegalArgumentException : Empty bindArgs,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16383471/

10-10 23:07