我想通过从本地检索值来自动登录,但是我无法做到它没有给出任何错误,也没有任何错误,我无法执行查询。请引导我穿过右门。
````
ionViewWillEnter() {
alert("Check Will Enter in Login Page");
console.log("Login Screen");
{
this.database.executeSql("SELECT * FROM user DESC LIMIT 1", []).then((userdata) => {
{
let toast = this.toastCtrl.create({
message: 'User is validated successfully',
duration: 3000,
position: 'bottom'
});
toast.onDidDismiss(() => {
console.log('Dismissed toast');
});
toast.present();
}
this.navCtrl.push(DashboardPage);
alert("1" + JSON.stringify(userdata));
alert("Check login_id-" + userdata.rows.item(0).login_id);
alert("Check password-" + userdata.rows.item(0).password);
alert("Check password-" + userdata.rows.item(0).mobile_no);
alert("DeviceID CHECK retrieving from USER" + userdata);
}, (error) => {
alert("AUTO LOGIN ERROR" + JSON.stringify(error));
});
}
}
````
您必须在platform.ready()
方法内调用您的SQL执行。
ionViewWillEnter() :void {
this.platform.ready().then(() => {
///your sql and other code
})