[英]How to update the old database file with the new database file in android?
I am having an application which i uses sqlite .db in that. 我有一个在其中使用sqlite .db的应用程序。 I am having a existing Database file in that application .
我在该应用程序中已有一个数据库文件。 So now what i have to do is i have to make a connection and i should download the new .db file and i have to replace the existing .db with the new .db file that i had downloaded.
所以现在我要做的是建立连接,我应该下载新的.db文件,并且必须用下载的新.db文件替换现有的.db。
I am keeping my .db file in the assests folder of the application . 我将.db文件保存在应用程序的assests文件夹中。 People are saying it is only Readable folder and we cant delete any file from that folder .
人们说这只是可读文件夹,我们不能从该文件夹中删除任何文件。
So please let me know how to solve this problem . 所以请让我知道如何解决这个问题。
you can change the DatabaseHelper class constructor for updating the database name,Version number is very important. 您可以更改DatabaseHelper类的构造函数以更新数据库名称,版本号非常重要。
public DatabaseHelper(Context context, String dbName, null, int dbVersion)
{ {
super(context, dbName, null, dbVersion);
// TODO Auto-generated constructor stub
}
instead of using like this 而不是像这样使用
public DatabaseHelper(Context context) {
super(context, dbName, null, dbVersion);
// TODO Auto-generated constructor stub
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.