开发者社区 问答 正文

androd sqlite update 语句不执行

单独更新imagepath字段语句执行没有效果。imagepath和description一起更新就有效果,为什么?
代码:
String sql = "update t_pattern set name = ? ,userid = ?,description=?, imagePath = ? where _id = ?";
db.execSQL(sql,
new Object[] { sInstance.getName(), sInstance.getUserid(),
sInstance.getDescription(), sInstance.getImgPath(),
sInstance.getId() });
表创建代码:
sql = "create table t_pattern (_id integer primary key autoincrement,name text default ('name'),userid integer,description text default ('description'),devicenum integer default(0),imagePath TEXT)";
db.execSQL(sql);

展开
收起
a123456678 2016-07-18 15:31:34 2143 分享 版权
1 条回答
写回答
取消 提交回答
  • 应该是db.execSQL(new String[]{'userid','description'})这样的语法

    2019-07-17 19:57:58
    赞同 展开评论
问答分类:
问答标签:
问答地址: