更新数据库的Android [英] Update Database Android
本文介绍了更新数据库的Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能告诉我如何在Android的更新数据库。我创建了一个应用程序和嵌入式数据库。我改变了数据库的版本清单,并建立了对更新方法。我想测试一下,看看数据库是否正常更新,但是当我用ADB命令只有-r会让我做了重新安装,但它会使数据库。有没有一种方法来运行的adb命令,让我来更新数据库。谢谢你。
Can anyone tell me how to update the database in android. I created an app with an embedded database. I changed the version of the database in the manifest and created the on update method. I wanted to test it to see if the database was updating properly but when I use the adb command only the -r will allow me to do a reinstall but it keeps the database. Is there a way to run the adb command that will allow me to update the database. Thanks.
推荐答案
下面是我会怎么处理我的updateRow方法:
Here is how I would handle my updateRow method:
public void updateRow(long rowId, String code, String name) {
ContentValues args = new ContentValues();
args.put("code", code);
args.put("name", name);
db.update(DATABASE_TABLE, args, "_id=" + rowId, null);
}
这篇关于更新数据库的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文