sqlite的DB更新 [英] sqlite db update

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

问题描述

有没有一种简单的方法,以在Android的更新sqlite的表? (如在建方法一行)?我有几个列一个表,主要是一列。我想通过主键在表中进行搜索,然后更新一行。

Is there an easy way to update a table in sqlite in android? (like a single line in built method) ? I have a table with few columns and primary is one column. I want to search by the primary key and then update a row in the table.

推荐答案

您可以使用 rawQuery 是这样的:

cur = mDb.rawQuery("update " + TABLE_NAME
+ " set column1=mango where id='" + _id + "'",null);


其中


where

  • CUR 光标 的对象
  • TABLE_NAME 表的名称
  • _id 的列名 的(唯一的例子)

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

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