我正在尝试更新Android项目中SQLite数据库表中的单个列.当车号相同时,我想将“ done”列的值设置为1.除了使用myDB.update外,我更喜欢使用SQL查询.所以我用这个查询
update 'details' set done = 1 where vehicle=="*****"
但是问题是,此查询在sqlite数据库浏览器中运行正常,而不是在android模拟器中.这在android模拟器上完全不起作用.希望您的建议.
提前致谢.
解决方法:
//Declaration
SQLiteDatabase dbx;
ContentValues cv1;
EventDataSQLHelper eventsData;//object of class in which table is created
//on create
eventsData = new EventDataSQLHelper(this);
dbx= eventsData.getReadableDatabase();
cv1 = new ContentValues();
cv1.put("done",1);
//update query
dbx.update("details", cv1, "vehicle=" ? , null);
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!