Android SQLite:更新语句 [英] Android SQLite: Update Statement

查看:51
本文介绍了Android SQLite:更新语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的应用程序中实现 SQLite.我跟着这个教程..在Android one中创建和使用数据库

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.

推荐答案

您可以使用下面的代码.

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

这篇关于Android SQLite:更新语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆