Android的SQLite的:更新语句
问题描述:
我需要在我的应用程序中实现的SQLite。我跟着这个教程.. Creating而在Android的之一使用的数据库
I need to implement SQLite in my application. I followed this tutorial.. Creating and using databases in Android one
一切工作正常。我插入1行5列。 现在我想更新1列的值只能和其他人将保持不变。
Everything is working fine. I inserted 1 row with 5 columns. Now I want to update value of 1 column only and others will be remain same.
有一个在教程中一个更新的方法,但它需要的所有参数,但我想更新一列。
There is one update method in tutorial but it needs all the parameters, however I want to update only one column.
答
您可以使用下面的code。
You can use the code below.
String strFilter = "_id=" + Id;
ContentValues args = new ContentValues();
args.put(KEY_TITLE, title);
myDB.update("titles", args, strFilter, null);