【发布时间】:2018-09-11 19:49:24
【问题描述】:
我在我的 ionic-3 应用程序中使用 SQLite 本机插件,当我尝试查询以获取具有一些学生 ID 的学生时,查询不起作用。这给出了空结果。
//studentIds array
let studentIds = [1,2,4,5];
//Query part
this.database.executeSql("Select * from student where id in (?)", [studentIds]).then(data => {
let students = [];
for(let i=0; i < data.rows.length; i++) {
students.push({id: data.rows.item[i].id, name: data.rows.item[i].name});
}
return students;
});
【问题讨论】:
-
你是什么意思它'不工作',你收到一个错误,不正确的数据,什么?
-
还因为您使用的是本机插件 - 您使用的是真实设备或适当的模拟器,对吗?不是离子服务等?
标签: sqlite cordova ionic-framework ionic3 ionic-native