我有一个sqlite数据库test_db.db我保存在www文件夹中我使用cordova cli在我的本地机器上构建android应用程序。
当我尝试打开数据库时,它正在打开新数据库而不是访问预先填充的数据库。
我使用以下代码对此进行了测试。
//打开现有数据库 var db = window.sqlitePlugin.openDatabase({name:“test_db.db”});
db.transaction(function (tx) {
alert("database opened");
var _strQuery = "select * from mst_users;";
tx.executeSql(_strQuery, [], function (tx, res) {
alert("Populated Successfully with " + res.rows.length + " Records.");
}, CommonError);
}, CommonError, DoNothing);
每次我收到一个错误,表mst_users不存在,但它在预先填充的数据库中存在。
我已经尝试过各种各样的事情来实现这一目标但却被激怒了。我想访问预填充数据库中的数据。
真的很感激任何帮助..