由网友(忆逝ゞ)分享简介:谁能告诉我如何在Android的更新数据库。我创建了一个应用程序和嵌入式数据库。我改变了数据库的版本清单,并建立了对更新方法。我想测试一下,看看数据库是否正常更新,但是当我用ADB命令只有-r会让我做了重新安装,但它会使数据库。有没有一种方法来运行的adb命令,让我来更新数据库。谢谢你。Can anyone tell...
谁能告诉我如何在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);
}
相关推荐
最新文章