简体   繁体   中英

Update query in sqlite and Android

I am trying to update a single column in a SQLite database table in my Android project. What I want to do is set the value of "done" column to 1, when the vehicle number is same. I preferred to go with sql queries other than using myDB.update . So I used this query,

update 'details' set done = 1 where vehicle=="*****"

But the problem is, this query is working perfectly in the sqlite databse browser, not in android simulator. This is completely not working at the android simulator. Hope ur advice. Thanks in advance.

  //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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM