【问题标题】:I have a syntax error when updating list of items in the room ( (1) near "?": syntax error ) [closed]更新房间中的项目列表时出现语法错误(“?”附近的(1):语法错误)[关闭]
【发布时间】:2021-02-24 11:24:51
【问题描述】:

我的错误:

databaseE/SQLiteLog: (1) "?" 附近: "update posts_table" 中的语法错误 设置列表 = ?,?哪里 id= ?”

我的代码:

@Query("update posts_table set list = :list where id= :id")
    Completable updatePost(int id, ArrayList<Integer> list);

【问题讨论】:

  • 请努力并更新您的问题以使其更清晰。人们很难理解你的问题。

标签: android sql-update android-room


【解决方案1】:

这样写

@Query("update posts_table set list = :list where id= :id")

void updatePost(ArrayList list,int id);

我建议你将arraylist转换为字符串,然后在db中添加数据 不要直接将arraylist添加到其中

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-02
    • 2019-12-22
    • 1970-01-01
    • 2022-06-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-25
    相关资源
    最近更新 更多